enigma-devel
[Top][All Lists]
Advanced

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

Re: [Enigma-devel] memory management problem


From: Daniel Heck
Subject: Re: [Enigma-devel] memory management problem
Date: Wed, 18 Jun 2003 00:34:44 +0200

Petr Machata wrote:

> While observing the memory management in Enigma code, I discovered
> that rather small number of on_removal()s get called. I think that
> problem is that the removal() itself never gets called, and that in
> turn happens because yield() never gets called (as to my best
> knowledge, yield() is the only method that calls removal()).

Yes, on_removal() is in fact rarely called.  In fact, it's only called
during the game when you replace or kill game objects.  Its main purpose
it to remove the object's models from the display engine.  When a level
is cleared this method is *not* called, because the display engine gets
reset anyway.

Releasing resources should really not be handled in on_removal() but in
the classes' destructor. (See OxydStone for an example.)

> 
> If it's true, (and my precious debugging messages say so), and if we
> can fix this problem, major part of remaining leak could be taken care
> of. on_removal() usually releases resources... I didn't yet quite got
> all Enigma internals, so I'm leaving this problem public. This looks
> like the system-wide thing that can be simply hacked around, but is
> not so simple to fix properly.

I *think* (but may well be mistaken) that this should not cause any
memory leaks.  Do you have an example where it does?

Cheers
Daniel

-- 
Daniel Heck
http://www.rzuser.uni-heidelberg.de/~dheck/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]