?
Solved

Don't know what happens, my application just hang

Posted on 2003-03-07
12
Medium Priority
?
194 Views
Last Modified: 2010-04-01
Hi Guru:

I am so frustrated with my application. I run it and it hangs, not giving me any message. Finally I found that my application might reach maximum size. I don't know, just guess. I use Borland C++. I have to change the code to reduce the size, then I can run it. But the problem is that I still need add more code. I don't understand, my code could be any large and should not be limited to some size. Please let me know what is real problem. Every time I add more codes, I got problem. I reduced and then can run it. Thanks.
0
Comment
Question by:http29
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
  • +2
12 Comments
 
LVL 6

Expert Comment

by:gj62
ID: 8090391
How much are you putting on the stack, vs on the heap?

Sounds like you are reaching a stack size issue.

Are you creating any large arrays, or medium size arrays with large structures?  If so, consider putting them on the heap with malloc().

Of course, this is all a SWAG since I've got no idea what your code looks like...

0
 
LVL 8

Expert Comment

by:Exceter
ID: 8090411
>> I have to change the code to reduce the size, then I can run it. But the problem is that I still need add more code.

Are you sure that the code you are removing isn't causing the program to freeze?

Exceter
0
 
LVL 10

Expert Comment

by:substand
ID: 8090827
are you forgetting to get out of a loop?  are you accessing null pointers?

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:http29
ID: 8091186
I am sure that the code I removed doesn't cause the programm to freeze because I just removed debug statements like cout << "..." << endl; Also I am not getting into the loop, should be not accessing null pointer, otherwise, I should get error message at least. Probably I am reaching a stack size. I do have large size array. What u mean by SWAG or by "putting them on the heap with malloc()". U mean using dynamic allocated memory instead of large array? Can I increase the stack size? How can I know how much I put on the stack, how much on the heap. Thanks.
0
 
LVL 6

Expert Comment

by:gj62
ID: 8091255
SWAG = Scientific Wild A** Guess, or something to that approximation <grin>

To dynamically allocate memory (on heap instead of stack), instead of saying

type ReallyBigArray[arraysize]; or something like it, try

type *ReallyBigArray;

ReallyBigArray = (type *)malloc(sizeof(type) * arraysize);

Type can be anything - char, int, struct, etc.

I don't use Borland, but I think you can find (and even set) the stack size using the _stklen global variable.  I suggest, however, that a much better method would be to dynamically allocate the array (and any other large blocks of memory) on the heap.  As far as heap space - how much memory do you have... <grin>  

If this doesn't do it, what OS version and version of the compiler are you running under?  I probably can't help too much more, since manipulating stack size is done within each compiler, and as I said, I don't have Borland...
0
 
LVL 5

Expert Comment

by:Kocil
ID: 8093066
Check your Options-Compiler-Code Generation.
If the model there is tiny, small or compact, you have the chance to fix it by using large or huge model.

0
 
LVL 5

Expert Comment

by:Kocil
ID: 8093072
If the model is already large or huge,
don't use Borland C++ anymore and switch to DJGPP.
0
 

Author Comment

by:http29
ID: 8098272
Hi Kocil:

My model is huge model like you said. How easy to switch to DJGPP. I never used this one before and my project doesn't allow me more time to learn. We alreay released two versions. We got to keep going. So your help would be very much appreciated. Is DJGPP free download or need to buy? How much it is or the website? Thank you so much.
0
 
LVL 6

Expert Comment

by:gj62
ID: 8098532
For DJGPP, go here:

http://www.delorie.com/djgpp/

0
 
LVL 5

Expert Comment

by:Kocil
ID: 8099402
DJGPP is free,
but i'm not sure about the license (GPL or else).
0
 
LVL 5

Accepted Solution

by:
Kocil earned 240 total points
ID: 8099857
About three years ago I was switching from Borland C++ 3.1 to DJGPP:
1. The IDE is similar. DJGPP use RHIDE which is build using Turbo Vision.
2. All standard C++ libraries worked fine.
3. BGI did not work, I have to use another VESA graphic libary (available from DJGPP site).
4. Borland data structure did not work, but I switched to STL.

But that 3 years ago. I just visited the DJGPP site again, and there ara a lot of new libraries, including networking. /* The one that I wanted so much, too late now :) */



0
 

Author Comment

by:http29
ID: 8129876
Thank both Kocil and qj62. I understand that only one comment of your comments will be accepted as my answers. I feel very tough but would give to Kocil this time. But I really appreciate qj62.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses
Course of the Month12 days, 13 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question