Re: Solve memory problems [message #64719 is a reply to message #64623] |
Tue, 13 January 2009 06:34   |
corinnefrey
Messages: 18 Registered: November 2006
|
Junior Member |
|
|
hi carsten,
indeed, this is the case in my actual problem. i am using a programme,
which uses several subprogrammes and subsub-programmes. between each
level there is an exchange of variables. if i defined all variables
and return-variables at the beginning, i would run out of memory just
by defining the variables. but probably i could make a compilation of
the "most wanted" variables to have them at a constant place from the
beginning. could be worth checking out!
thanks,
corinne
> All the memory you use in a function or procedure is given back when that
> function returns, except for any variables that are handed back via
> arguments or function return values.
>
> This is pure conjecture, but maybe you use some memory in your function, then
> allocate more memory for the return value, then return, freeing the earlier
> memory, but leaving you with the return value allocated somewhere "in the
> middle" of the heap memory, thereby fragmenting it more and more with each
> call of the function. Then, it should make a difference if you allocate
> your return array at the beginning of your function.
>
> Maybe you could use memtest.pro to investigate the fragmentation problem?
>
> chl
|
|
|