[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: heap_gc behaviour

martin rother (rother@gfz-potsdam.de) writes:

>    I detected now a 'heap_gc' behaviour, which I don't *understand*,
>    but I'm *not sure* if this is a bug, an annoying feature or ...
>    A call of 'heap_gc' inside a routine destroys a
>    a heap-variable given as parameter.... ?
>    Yes, I have read the reference manual... but as long I understand
>    a call of 'heap_gc' inside a function is not forbidden.
>    I add here a small demonstration: a 'batch', a tiny function which is 
>    called and the IDL messages.
>    any hints?

Humm. Well, I don't know. But since you asked for "hints", which
I read as "advice", here is one.

   Heap_GC is an admission of failure.

I'm of the opinion it should only be used after
you have closed the door to your office and sent
your office mate out for a couple of Danish. Putting
it in a program is, to me, a mark of a ... well, an
*inexperienced* programmer. :-)

Much better to learn how to free pointers and
destroy objects correctly than have to resort to
Heap_GC. About the only time it can legitimately
be used is during program development and before
you have added all your CATCH error handlers. 



David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155