Mail Archives: djgpp/2004/08/23/15:03:01
> From: apendzich AT plusnet DOT pl (Artur)
> Date: 23 Aug 2004 00:50:01 -0700
>
> Is it possible that stack is overwritten by heap?
The stack cannot possibly be overwritten by the heap because the stack
is below the heap in the DJGPP run-time memory layout. Since the heap
grows upward, while the stack is allocated at program startup time and
thereafter never changes, what you fear cannot happen.
Btw, it could well be that the debugger shows bogus values of the
function arguments due to optimizations. I suggest to step several
lines into the function and then display the values of arguments
again, before you conclude that they are indeed garbled.
> I was calling a _go32_dpmi_remaining_physical_memory function and it
> shows that I have a lot of space (37MB) still free.
That doesn't say anything about the stack. The stack is allocated in
one chunk at the beginning of the program, and can never grow. Its
default size in DJGPP programs is 512KB.
There's a library function called `stackavail' that will tell you how
much stack space you have left at the point where you call it. But I
doubt that this is the right way to debug the problem in your case.
> I can load datafile without problems. Problem appears when
> I try to call a function inside my program with values as parameters (
> int some_fun( long double var1, long double var2, int var3)).
It would help if you describe what is that ``problem'' that appears
with the larger data file. If the program crashes, post here its full
crash message (after running bfdsymify on it). If the ``problem''
manifests itself in some other way, please describe it in as much
detail as you can. Then someone might have an idea about the possible
reason(s) of your problem.
- Raw text -