Just for fun [message #77461] |
Wed, 07 September 2011 12:54  |
Bob[4]
Messages: 24 Registered: April 2009
|
Junior Member |
|
|
Try this:
p=plot(findgen(10))
help, /Heap
obj_destroy, p
help, /Heap
Yikes! This makes me fear New Graphics.
|
|
|
|
Re: Just for fun [message #77527 is a reply to message #77461] |
Fri, 09 September 2011 01:07   |
Wout De Nolf
Messages: 194 Registered: October 2008
|
Senior Member |
|
|
On Wed, 7 Sep 2011 12:54:23 -0700 (PDT), Bob <bobnnamtrop@gmail.com>
wrote:
> Yikes! This makes me fear New Graphics.
Exactly! Even closing the window doesn't clean up everything:
IDL> .RESET_SESSION
IDL> help,/heap
Heap Variables:
# Pointer: 0
# Object : 0
IDL> p=plot(findgen(10))
IDL> help,/heap
Heap Variables:
# Pointer: 5031
# Object : 4425
IDL> obj_destroy,p ; Window is still there
IDL> help,/heap
Heap Variables:
# Pointer: 5031
# Object : 4424
...close window...
IDL> help,/heap
Heap Variables:
# Pointer: 1171
# Object : 1399
This would make sense if the next plot reuses some of these objects:
IDL> p=plot(findgen(10))
IDL> help,/heap
Heap Variables:
# Pointer: 5050
# Object : 4445
It seems to do that, but some objects are not reused/deleted, so
plotting+closing many times increases heap allocation. This serves no
purpose that I can think of.
|
|
|
Re: Just for fun [message #77577 is a reply to message #77527] |
Mon, 12 September 2011 13:30  |
Bob[4]
Messages: 24 Registered: April 2009
|
Junior Member |
|
|
Yes, I agree. I should have left out the stuff about obj_destroy, the scary thing is just that 5031 pointer variable and 4425 object variables are made just for a simple plot. (Interestingly I get slightly different numbers for the same command.) At the least idl should hide these heap variables from the user, IMHO.
|
|
|