Object Program Memory Leaking Everywhere! [message #10871] |
Thu, 12 February 1998 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Hi Folks,
Thanks to Mark Hadfield down New Zealand way who very kindly
buttered me up by calling my web site a "taonga". (I'm not
sure either, but I'm trying to find a way to go down there
to find out.) Then he very gently lowered the boom by telling
me that my object graphic programs were leaking memory like
a sieve.
Sure enough. I was making a couple of assumptions about
cleanup routines that were just plain wrong. If you have
downloaded any of these routines, you might want to get the
latest. I think I have managed to stop up all of the leaks
now. The routines in question are:
XPLOT
XSURFACE
XIMAGE
XCONTOUR
VCOLORBAR
To see if your programs are leaking, try this. First, clean
up everything on the heap:
IDL> Heap_GC
Next, run your program:
IDL> XPLOT
Exit the program and check the heap:
IDL> Help, /Heap
If you have a bunch of objects and pointers in there, you are
leaking memory and you will want to fix it. I fixed it by
adding all of the objects I created in my program to a container
object. My program cleanup routine destroys this container,
which in turn calls the cleanup routines of all the objects
in the container. My mistake was in thinking that all of the
objects that belonged to the view were destroyed when the view
was destroyed.
Live and learn, I always say. :-)
Cheers,
David
-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|