comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: IDL Memory Leaks
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: IDL Memory Leaks [message #27671] Mon, 05 November 2001 13:58 Go to previous message
Myron Brown is currently offline  Myron Brown
Messages: 10
Registered: December 1999
Junior Member
David,

Thanks. I am using the TEMPORARY function. I know memory is leaking because the
Windows task manager indicates that my IDL process is consuming more and more
memory as time goes on. Of course, IDL doesn't realize this (i.e. HELP, /MEMORY
indicates no increase in memory usage).

Two questions:

1. How does UNDEFINE differ from setting the variable to zero (a and b below)?
The result appears to be the same, but is it?

(a) IF (N_Elements(varname) NE 0) THEN tempvar = Size(Temporary(varname))
(b) varname = 0

2. When my routine returns, does the memory allocated in that routine not get
free'd since the variables are no longer in scope? Are there cases when this is
not true?

Myron

David Fanning wrote:

> Myron Brown (brownmz1@jhuapl.edu) writes:
>
>> 4. The code includes repetitive reassignments of variables to large arrays,
>> even within a routine (still in scope). I tried to assign variables to zero
>> each time, but it doesn't seem to make a difference. Should this really be
>> necessary?
>
> I'd like to see how you are doing this (I hope you
> are using the TEMPORARY function!), as this is more
> than likely the source of your problem. You don't say
> how you know you are "leaking memory", but this is the
> kind of thing that will eat up process memory if you
> are not careful.
>
> If you have the same variable on both sides of an equal
> sign, you really need something like this:
>
> image = Temporary(image) * 5
>
> And when you are done with it:
>
> Undefine, image
>
> (The UNDEFINE program can be found on my web page.)
>
> Otherwise, you continually get more and more process
> memory (with malloc), and there is no way to give it
> back.
>
> "Is it necessary?". Yes, it is very, very necessary. :-)
>
> Cheers,
>
> David
> --
> David W. Fanning, Ph.D.
> Fanning Software Consulting
> Phone: 970-221-0438, E-mail: david@dfanning.com
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: NETSCAPE BOMB - dont open/preview "Re: my pretty floor won't pour before I expect it"
Next Topic: FFT issues

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 09:49:32 PDT 2025

Total time taken to generate the page: 0.87971 seconds