Re: Do we need PTR_FREE anymore? [message #71918] |
Thu, 29 July 2010 08:52 |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On Jul 29, 7:33 am, Chris <beaum...@ifa.hawaii.edu> wrote:
> My guess is that IDL periodically checks for reference-less heap
> variables and frees them, in which case there is a "limbo" period for
> such objects. If some piece of code is creating and destroying lots of
> heap memory (in a long loop, e.g.), then maybe it makes sense to clean
> up manually?
That is one possible implementation. But they could also be erased at
the moment their reference count reaches 0, which to me seems to be
the case in IDL, judging from the help on the garbage collector.
|
|
|
Re: Do we need PTR_FREE anymore? [message #71922 is a reply to message #71918] |
Thu, 29 July 2010 03:33  |
Chris[6]
Messages: 84 Registered: July 2008
|
Member |
|
|
On Jul 28, 3:48 pm, David Fanning <n...@dfanning.com> wrote:
> wlandsman writes:
>> The help files give one obscure example where automatic garbage
>> collection fails -- when "two objects or pointers refer to each other,
>> but no other object or pointer refers to either". Is there ever
>> any other reason (e.g. performance issues) to explicitly call PTR_FREE
>> anymore?
>
> Perhaps you just want to feel like you are a member
> of the professional programming fraternity.
>
> Cheers,
>
> David
>
> P.S. Or, you don't want to feel like a dope if someone
> runs your code in a version of IDL older than 8.0. :-)
>
> --
> 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.")
My guess is that IDL periodically checks for reference-less heap
variables and frees them, in which case there is a "limbo" period for
such objects. If some piece of code is creating and destroying lots of
heap memory (in a long loop, e.g.), then maybe it makes sense to clean
up manually?
chris
|
|
|
Re: Do we need PTR_FREE anymore? [message #71927 is a reply to message #71922] |
Wed, 28 July 2010 18:48  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
wlandsman writes:
> The help files give one obscure example where automatic garbage
> collection fails -- when "two objects or pointers refer to each other,
> but no other object or pointer refers to either". Is there ever
> any other reason (e.g. performance issues) to explicitly call PTR_FREE
> anymore?
Perhaps you just want to feel like you are a member
of the professional programming fraternity.
Cheers,
David
P.S. Or, you don't want to feel like a dope if someone
runs your code in a version of IDL older than 8.0. :-)
--
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.")
|
|
|