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

Re: Ghost object



Martin Schultz wrote:
> ..  but: suppose you create the font object while testing your object,
> then you edit
> and recompile while the object is still alive, removing the cleanup of
> something
> that caused the font object to appear -- well, THEN you may indeed find
> a situation
> where you have a memory leak. Hell, this is convoluted! If it works
> after you exit and
> restart, and doesn't show up again: why bother? I would only bother if
> you thought
> your program had finished the development stage and the error occurs
> reproducibly
> when running the code.
> 
> Martin

Thanks Martin, this would be an explanation. I tried to design this code
"leakproof". The object exists only for as long as its top base exists.
If its killed, cleanup is performed. I never execute the *creation* code
while its alive, only the event handling routine. Every single object
used in it was placed in a container to be wiped by the cleanup routine.
All objects are IDLgr***, so nothing I use is calling IDLGRFONT from
behind my back. Can compilation by itself create an instance of an
object? That would be strange.
Well, I'd leave it as it was, but yesterday, after *quitting* IDL and
starting over, everything was just fine for an hour. I was happy with
how it all worked, and never edited that part of the code again,
developing other parts. And... here again comes IDLGRFONT, Array[1]. I
recorded the number of objects created by my code and compared them with
the number of objects in containers, and I do remove everything I make.
Something else somewhere is creating that one. In fact, if I don't place
the *only* instance of IDLGRFONT I made in a container, then I get this
one remaining in the heap, too, so I end up with two leftover objects.
Strange. If this persists, I'll ask people to test the code on their machines.
I am beginning to think if accessing IDLgrText objects may in some
instances cause them to lose their Font objects? I have used them before
and never noticed that.
Cheers,
Pavel

P.S. If my first theory of tired IDL is true, then I should not see this
again till noon at least :-)