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

Home » Public Forums » archive » Re: IDL Shapefile Object
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: IDL Shapefile Object [message #28297 is a reply to message #28296] Thu, 29 November 2001 14:31 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
I wrote a few minutes ago:

> The problem here is that the shapefile object returns
> a structure that itself has pointers in it. (This is really
> the only way it can be done, because the object doesn't
> really know anything about the actual shapefile you will
> load.)
>
> When this happens, you are responsible for cleaning
> those pointers up yourself.

It has been pointed out to me that there is
a new routine in IDL 5.5 called HEAP_FREE that
is to be used for exactly this purpose. (I think
I overlooked it because it's not in the IDL 5.5 on-line
help, obviously, since the help is in... Oh, never mind.
I have probably beat that horse enough, although I still
think it is an ass-backwards way to release software.)

Anyway, despite the documentation that is meant to
frighten you away from using it (ala Heap_GC), it
is designed to help you clean up in those situations
where you don't know what it is you have been handed.
It will release (clean-up) all the heap variables
referenced by the argument to HEAP_FREE. So, in Kelly's
case, he could have cleaned up by doing something like
this:


pEnts = PTR_NEW(/ALLOCATE_HEAP)
*pEnts = oShapefile->GetEntity(/ALL, /ATTRIBUTES)
;
FOR I = N_ELEMENTS(*pEnts)-1, 0, -1 DO BEGIN
PlotEnt, (*pEnts)[I], color=color
ENDFOR
HEAP_FREE, pEnts

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Sparse matrix algorithms
Next Topic: Re: Setting history size in idlwave

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

Current Time: Fri Oct 10 12:23:47 PDT 2025

Total time taken to generate the page: 1.51716 seconds