F
Filippo Venturi
Thanks for your attention..
I've wrote a long statistical procedure in C language, involving tre
creation and the manipulation of big matrix of double float (about 64
per 500 cells per matrix.
These matrixes are created via malloc function since their size
depends on the input data file.
The function works fine if used once in a main file.
The problem is, if i call it 4 o more times in a FOR structure in the
main file,
the executable crashes in the fourth iteration since it can't
dinamically allocate the requested memory.
The function frees the used heap(?) space requested at the end of each
call, so i expect than if there is enough memory to run the procedure
once, and *if* *all* of the memory allocated is then freed, there
should be enough memory to run the procedure other times.
So I guess there is some memory that is still used by the previous
iteration.
Is there a way (a simple way would be even better ) (going into
debugging is not easy to me) to prove my guess is right or wrong?
maybe using function from stdlib (stackavail, memavl , memmax..)? And
finally is there a way to clear the heap (some kind of free(ALL) ) and
does it have any particular side-effect?
I'm compiling with Digital Mars Compiler via command line under
Windows XP with -mn memory model options
Thanks a lot in advance, and sorry if I've been too long or vague
Filippo
I've wrote a long statistical procedure in C language, involving tre
creation and the manipulation of big matrix of double float (about 64
per 500 cells per matrix.
These matrixes are created via malloc function since their size
depends on the input data file.
The function works fine if used once in a main file.
The problem is, if i call it 4 o more times in a FOR structure in the
main file,
the executable crashes in the fourth iteration since it can't
dinamically allocate the requested memory.
The function frees the used heap(?) space requested at the end of each
call, so i expect than if there is enough memory to run the procedure
once, and *if* *all* of the memory allocated is then freed, there
should be enough memory to run the procedure other times.
So I guess there is some memory that is still used by the previous
iteration.
Is there a way (a simple way would be even better ) (going into
debugging is not easy to me) to prove my guess is right or wrong?
maybe using function from stdlib (stackavail, memavl , memmax..)? And
finally is there a way to clear the heap (some kind of free(ALL) ) and
does it have any particular side-effect?
I'm compiling with Digital Mars Compiler via command line under
Windows XP with -mn memory model options
Thanks a lot in advance, and sorry if I've been too long or vague
Filippo