Re: yet another idl memory question [message #66789 is a reply to message #66689] |
Mon, 08 June 2009 11:22  |
pgrigis
Messages: 436 Registered: September 2007
|
Senior Member |
|
|
On Jun 4, 1:06 pm, David Fanning <n...@dfanning.com> wrote:
> Jean H. writes:
>> in which case you may want to save the
>> variable(s) to a file, free the memory (data=0B) and start processing
>> the next file.
>
> Of course, data=0B doesn't free *all* the memory,
> and doing this many times leads, I suspect, to the memory
> fragmentation that is the heart of the problem. I suggest
> you use UNDEFINE. That really does release *all* the memory
> associated with a variable.
Really? Certainly it's not a substitute for ptr_free, is it?
At least not in my system:
help,/mem
;heap memory used: 924074, max: 1972734, gets: 574,
frees: 135
;create pointer
a=ptr_new(bytarr(2LL^28))
help,/mem
;heap memory used: 269360586, max: 269360761, gets: 582,
frees: 140
.comp ~/undefine.pro ;makes sure I am using DF's undefine
;% Compiled module: UNDEFINE.
undefine,a
help,a
;A UNDEFINED = <Undefined>
help,/mem
;heap memory used: 269362262, max: 270427272, gets: 613,
frees: 164
heap_gc
help,/mem
;heap memory used: 926762, max: 269362382, gets: 624,
frees: 174
Ciao,
Paolo
> And it elegantly indicates
> what the code is actually doing, too, a significant
> advantage for people reading your code after you have
> run off to the tropics with that hot financial analyst
> over in the head shed. :-)
>
> http://www.dfanning.com/programs/undefine.pro
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Coyote's Guide to IDL Programming (www.dfanning.com)
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|