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

Home » Public Forums » archive » Re: Turn Object Automatic Clean-up Off?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Turn Object Automatic Clean-up Off? [message #81465] Thu, 20 September 2012 14:32
DavidF[1] is currently offline  DavidF[1]
Messages: 94
Registered: April 2012
Member
I wrote a couple of minutes ago:

> Alright, here is *another* irritating example. I have a widget program,
> cgZImage, that allows me to zoom into an image. As I move my cursor over
> the zoomed image, it prints out the image location and the value of
> the image at that location.

OK, too many moving parts for someone my age, I guess. Looks a LOT
like operator now. :-(

Sorry for the confusion.

Cheers,

David
Re: Turn Object Automatic Clean-up Off? [message #81466 is a reply to message #81465] Thu, 20 September 2012 14:11 Go to previous message
DavidF[1] is currently offline  DavidF[1]
Messages: 94
Registered: April 2012
Member
Marc writes:

> Out of curiosity:
>
> Could you please post an example code where this problem is exposed?
> How can an object which has no references any more be of relevance in
> an IDL program?
>
> I have a lack of imagination here.

Alright, here is *another* irritating example. I have a widget program,
cgZImage, that allows me to zoom into an image. As I move my cursor over
the zoomed image, it prints out the image location and the value of
the image at that location.

I'm working with GeoTiff files a lot, so it would be useful to
have the image location in lat/lon values rather than pixel values.
I want to pass the program a cgMap object, which is what I use to set up
a map projection and coordinate system. I can use this object to covert
a pixel location to a lat/lon value.

I create the map object outside the program:

mapObj = cgGeoMap(geoTiffFile, Image=image)

Then, I pass both the image and the map object into
my widget program:

cgZImage, image, Map=mapObj

Inside the program, I store the map object in the info
structure of the program, and try to use it in an event
handler. It is always invalid!!

Indeed:

IDL> mapObj = cgGeoMap(geoTiffFile, Image=image)
IDL> Print, Obj_Valid(mapObj)
1
IDL> cgZImage, image, MAP=mapObj
IDL> Print, Obj_Valid(mapObj)
0

Not at all what I wanted!

Cheers,

David
Re: Turn Object Automatic Clean-up Off? [message #81474 is a reply to message #81466] Thu, 20 September 2012 08:07 Go to previous message
Lajos Foldy is currently offline  Lajos Foldy
Messages: 176
Registered: December 2011
Senior Member
On Thursday, September 20, 2012 3:49:48 PM UTC+2, mschellens wrote:


> Out of curiosity:
>
> Could you please post an example code where this problem is exposed?
>
> How can an object which has no references any more be of relevance in an IDL program?
>
> I have a lack of imagination here.

Earlier, lost references could be restored. Try this example in a fresh IDL session:

; test.pro begin
pro s::print
print, "I'm fine!"
end

pro test
s={s, l:0}
o1=obj_new('s')
o1=0 ; lost reference
o2=obj_valid(1, /cast) ; restored
o2->print
end
; test.pro end

IDL> print, !version
{ x86_64 linux unix linux 7.0 Oct 25 2007 64 64}
IDL> test
I'm fine!
IDL>

IDL> print, !version
{ x86_64 linux unix linux 8.2 Apr 10 2012 64 64}
IDL> test
% Unable to invoke method on NULL object reference: <OBJREF (<NullObject>)>.


regards,
Lajos
Re: Turn Object Automatic Clean-up Off? [message #81475 is a reply to message #81474] Thu, 20 September 2012 07:09 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
mschellens writes:

> Could you please post an example code where this problem is exposed?
> How can an object which has no references any more be of relevance in
> an IDL program?
> I have a lack of imagination here.

I think I was probably doing something wrong in the
development of my code. I had a procedure that was
creating a data object and then exiting. When I went
to use my data object, it was gone.

I've restructured the code now, and it seems to run
correctly even if I don't disable automatic garbage
collection, so... I don't have time to fool with it
this morning. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Turn Object Automatic Clean-up Off? [message #81476 is a reply to message #81475] Thu, 20 September 2012 06:49 Go to previous message
m_schellens is currently offline  m_schellens
Messages: 31
Registered: February 2005
Member
On Sep 18, 10:27 pm, Coyote <sageande...@gmail.com> wrote:
> Folks,
>
> It turns out I have written a program that more or less depends on an object's persistence in the IDL environment. This program is not working in IDL 8.2 because the object is automatically cleaned up. It seems to me, I remember reading somewhere how to turn the automatic clean up off for objects, but as usual the documentation is hopeless.
>
> Does anyone know how to turn this off?
>
> Thanks!
>
> David


Out of curiosity:
Could you please post an example code where this problem is exposed?
How can an object which has no references any more be of relevance in
an IDL program?
I have a lack of imagination here.

Greetings,
Marc
Re: Turn Object Automatic Clean-up Off? [message #81487 is a reply to message #81476] Tue, 18 September 2012 14:03 Go to previous message
Lajos Foldy is currently offline  Lajos Foldy
Messages: 176
Registered: December 2011
Senior Member
On Tuesday, September 18, 2012 10:57:49 PM UTC+2, Coyote wrote:
> Lajos writes:
>
>> "The HEAP_REFCOUNT function returns the current reference count for a pointer or object reference (a heap variable). It can also be used to disable garbage collection for a heap variable, or for all heap variables."
>
>
> Thanks. Big reference at the top of this help page with a link: "See _Automatic Garbage Collection_ for detailed information." But "Automatic Garbage Collection" in the index comes up with absolutely nothing. Sigh... Nothing under "objects", either. All under "heap variables," as if that is the first thing that comes to a user's mind when thinking about objects. How could a new user or a non-IDL newsgroup reader figure any of this out!?
>
> Cheers,
>
> David

Probably the Automatic Garbage Collection information was garbage collected automatically :-)

regards,
Lajos
Re: Turn Object Automatic Clean-up Off? [message #81488 is a reply to message #81487] Tue, 18 September 2012 13:57 Go to previous message
DavidF[1] is currently offline  DavidF[1]
Messages: 94
Registered: April 2012
Member
Lajos writes:

> "The HEAP_REFCOUNT function returns the current reference count for a pointer or object reference (a heap variable). It can also be used to disable garbage collection for a heap variable, or for all heap variables."

Thanks. Big reference at the top of this help page with a link: "See _Automatic Garbage Collection_ for detailed information." But "Automatic Garbage Collection" in the index comes up with absolutely nothing. Sigh... Nothing under "objects", either. All under "heap variables," as if that is the first thing that comes to a user's mind when thinking about objects. How could a new user or a non-IDL newsgroup reader figure any of this out!?

Cheers,

David
Re: Turn Object Automatic Clean-up Off? [message #81489 is a reply to message #81488] Tue, 18 September 2012 13:43 Go to previous message
Lajos Foldy is currently offline  Lajos Foldy
Messages: 176
Registered: December 2011
Senior Member
On Tuesday, September 18, 2012 10:27:02 PM UTC+2, Coyote wrote:
> Folks,
>
> It turns out I have written a program that more or less depends on an object's persistence in the IDL environment. This program is not working in IDL 8.2 because the object is automatically cleaned up. It seems to me, I remember reading somewhere how to turn the automatic clean up off for objects, but as usual the documentation is hopeless.
>
> Does anyone know how to turn this off?
>
> Thanks!
>
> David


"The HEAP_REFCOUNT function returns the current reference count for a pointer or object reference (a heap variable). It can also be used to disable garbage collection for a heap variable, or for all heap variables."

regards,
Lajos
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: A new IDL Product Manager
Next Topic: Is MAP procedure in IDL8.2 BROKEN?

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

Current Time: Wed Oct 08 15:23:05 PDT 2025

Total time taken to generate the page: 0.00505 seconds