Main Page | Report Page

 

  Computers Forum Index » Computer Languages (IDL-PVWAVE) » IDL 8.0 garbage collector issue....

Author Message
Bubba...
Posted: Wed Oct 20, 2010 12:47 pm
 
I have found something that doesn't seem quite right to me with
regards to the IDL 8.0 garbage collector.

If you have a function that returns a pointer array and you try to
tuck that call into another function call (n_elements for instance)
the pointer gets freed before the second function call completes.
Here is an example program that I wrote to show my problem...

function createPointerArray
compile_opt idl2, logical_predicate

data = ptrarr(3)
data[0] = ptr_new(indgen(10))
data[1] = ptr_new(indgen(10))
data[2] = ptr_new(indgen(10))

return, data
end

pro testGarbageCollector
compile_opt idl2, logical_predicate

; The return from createPointerArray gets destroyed before the
n_elements call is complete
print, n_elements(*(createPointerArray())[0]) ; Prints 0

data = createPointerArray()

print, n_elements(*data[0]) ; Prints 10
end

Am I missing something? Is this expected behavior? It seems to me
that you should be able to do this. It would just be extra unneeded
code to store the return into a variable just to be able to access
it. I use code like this a lot and I can't afford to update it
everywhere.

Please help!
Thanks
 
wlandsman...
Posted: Wed Oct 20, 2010 2:24 pm
 
On Oct 20, 8:47 am, Bubba <boc... at (no spam) gmail.com> wrote:

Quote:
Am I missing something?  Is this expected behavior?  It seems to me
that you should be able to do this.  It would just be extra unneeded
code to store the return into a variable just to be able to access
it.  I use code like this a lot and I can't afford to update it
everywhere.

I agree that this looks like a bug in the IDL 8.0 garbage
collection. It works correctly in IDL 7.1.

One "fix" is to turn off garbage collection (so your code works the
same as in IDL 7.1) by adding

!null = heap_refcount(/disable)

to your startup file. --Wayne
 
Paulo Penteado...
Posted: Wed Oct 20, 2010 3:58 pm
 
On Oct 20, 10:47 am, Bubba <boc... at (no spam) gmail.com> wrote:
Quote:
Am I missing something?  Is this expected behavior?  It seems to me
that you should be able to do this.  It would just be extra unneeded
code to store the return into a variable just to be able to access
it.  I use code like this a lot and I can't afford to update it
everywhere.

If you are missing something, then so am I. To me it looks like a bug.
 
Bill Dieckmann...
Posted: Wed Oct 20, 2010 6:41 pm
 
On Oct 20, 8:47 am, Bubba <boc... at (no spam) gmail.com> wrote:
Quote:

Am I missing something?  Is this expected behavior?

I reported this to ITTvis a couple of months ago. The support engineer
told me
it will be fixed in the next upcoming IDL update.
 
David Fanning...
Posted: Wed Oct 20, 2010 8:17 pm
 
Paulo Penteado writes:

Quote:
If you are missing something, then so am I. To me it looks like a bug.

Isn't it interesting how difficult it is to tell if
something is a bug or not? It is particularly difficult
for me in IDL 8. I had built up some confidence in IDL
over the years, so I was getting better at this. Now
my confidence is back to about where it was when I was
just starting out, all those many years ago. ;-)

Cheers,

David

P.S. Let's just say Coyote's take on this is that it's
like being endlessly young and naive. The whole world
our oyster again!



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
 
Chris Torrence...
Posted: Thu Oct 21, 2010 3:19 pm
 
On Oct 20, 12:41 pm, Bill Dieckmann <bill.d... at (no spam) gmail.com> wrote:
Quote:
On Oct 20, 8:47 am, Bubba <boc... at (no spam) gmail.com> wrote:



Am I missing something?  Is this expected behavior?

I reported this to ITTvis a couple of months ago. The support engineer
told me
it will be fixed in the next upcoming IDL update.

It is indeed fixed in the upcoming 8.0.1 patch (should be just a few
weeks).

-Chris
ITTVIS
 
Bubba...
Posted: Thu Oct 21, 2010 4:39 pm
 
On Oct 21, 11:19 am, Chris Torrence <gorth... at (no spam) gmail.com> wrote:
Quote:
On Oct 20, 12:41 pm, Bill Dieckmann <bill.d... at (no spam) gmail.com> wrote:

On Oct 20, 8:47 am, Bubba <boc... at (no spam) gmail.com> wrote:

Am I missing something?  Is this expected behavior?

I reported this to ITTvis a couple of months ago. The support engineer
told me
it will be fixed in the next upcoming IDL update.

It is indeed fixed in the upcoming 8.0.1 patch (should be just a few
weeks).

-Chris
ITTVIS

Awesome, I will axiously await the new release then:) Thanks for all
the replies.
 
 
Page 1 of 1    
All times are GMT
The time now is Sat Aug 02, 2014 12:33 am