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

Home » Public Forums » archive » Re: Proper pointer cleanup question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Proper pointer cleanup question [message #34651 is a reply to message #34648] Tue, 08 April 2003 17:09 Go to previous messageGo to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
JD Smith wrote:
>
> On Mon, 07 Apr 2003 16:01:27 -0700, M. Katz wrote:
>
>> I want to make sure I'm taking all the steps necessary to clean up
>> pointers and free memory when I'm done with them. Here's an example.
>>
>> Suppose I have a pointer to a structure that contains pointers.
>>
>> a = ptr_new({n:10, p:ptrarr(10)})

<snip>

>> 2) a and all of its dependent pointers: for i=0,n_elements( (*a).p )-1
>> do $
>> ptr_free, ((*a).p)(i)
>> ptr_free, a
>>

<snip>

> Another option is:
>
> heap_free,a
>
> which will accomplish the same as #2 (avoiding a memory leak), and is
> only slightly slower. When you're feeling truly lazy, it's quite a
> blessing. You have no flexibility to pick and choose what to parts of
> a data structure to free, but often this isn't an issue.

Wha..? Is that another one of those undocumented IDL routines? It works on my current
version, but bugger me if I can find it documented anywhere.

paulv

--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
Ph: (301)763-8000 x7748
Fax:(301)763-8545
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Pb to work with huge files
Next Topic: Re: Where is the trick in objects

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

Current Time: Fri Oct 10 05:43:48 PDT 2025

Total time taken to generate the page: 0.79869 seconds