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

Home » Public Forums » archive » Re: HANDLE_FREE: when to use? is it necessary?
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: HANDLE_FREE: when to use? is it necessary? [message #6624] Tue, 23 July 1996 00:00
mgs is currently offline  mgs
Messages: 144
Registered: March 1995
Senior Member
In article
<Pine.SOL.3.91.960722114953.671B-100000@mapper.mbt.washington.edu>, Russ
Welti <rwelti@mapper.mbt.washington.edu> wrote:

Hi Russ -

> I was told once by RSI that if one is only about to reassign
> a handle to point to a NEW piece of data (when it already
> points to some other data) it is *not* necessary to call
> HANDLE_FREE.

That sounds reasonable. Calling Handle_Create probably chews up a couple
hundred bytes each time. More importantly, what happens to the data that
you were pointing to before you reassigned the handle? Reassigning the
handle doesn't make the data or its associated memory disappear.

> Also, interestingly, using grep in idl's home /lib dir and in
> several pub domain dirs which have hundreds of IDL source files
> and applications, I can find only 3 or 4 occurrences of 'handle_free'
> OR 'HANDLE_FREE'. Why does it not get used? Why does the manual
> never say or show how to use it? Is it really so unimportant?

I'd have to say the reason for the lack of Handle_* in /lib is due to it's
newness. I think it's only been around about 18 months, or so. Prior to
the Handle_*'s coming around, the method was to use unrealized base
widgets (looking for Widget_Base in /lib may not help since it could be
used for its intended purpose, as well). Basically, the Handle_* routines
came about as a means of getting away from the use of Widget_Base, which
was even less intuitive and more confusing than Handle_Value. The
Handle_Free routine should be used to free up memory within programs
because these are created in global memory space. However, I suspect that
the problem might be that you are copying data (are you using the /No_Copy
keyword each time?). If so, then you may have several copies of unused
data throughout your program. If this isn't the case, feel free to send
some code this way and I'll look it over.

...
> The only possible source would seem to be the fact that I am
> not explicitly freeing handles, I am simply pointing them to
> new things.
>
> If freeing handles is really the answer, and is a required practise,
> then why so few occurrences of its use in IDL programs?

Again, newness of the Handle_* commands is my guess. Commands that are
available in some of the on-line libraries (i.e. Ray Sterner's library
from Johns Hopkins Univ.) have often been around for many years. It's not
likely that someone would update them just to take advantage of the latest
functions. Perhaps the RSI documentation needs to catch up a little, also.

> Anyone ever gotten a good FAQ on IDL memory management, beyond the
> few pointers given in the User's Guide, and what can be gleaned
> from the C programming info in the Advanced Dev. Guide??

Well, I understand RSI has training classes in Widget Programming ...

--
Mike Schienle
Custom Data Visualizations
mgs@visdata.com http://www.visdata.com/
[Message index]
 
Read Message
Previous Topic: xrange,yrange and zrange in surface
Next Topic: Foreign fonts and map boundary problems in IDL

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

Current Time: Sat Oct 11 00:33:53 PDT 2025

Total time taken to generate the page: 1.27507 seconds