[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-freedink] Re: FreeDink memory leaks.
From: |
Sylvain Beucler |
Subject: |
[Bug-freedink] Re: FreeDink memory leaks. |
Date: |
Thu, 15 May 2008 09:19:23 +0200 |
User-agent: |
Mutt/1.5.17+20080114 (2008-01-14) |
Hi,
On Wed, May 14, 2008 at 07:47:11PM +0200, José María Pavón Núñez wrote:
> Hello,
>
> I also have confirmed the memory leak when re-loading sounds. It only
> happens after restart a game but is solved adding at CreateBufferFromWaveFile
>
> FreeRegisteredSound(index);
>
> before
>
> SDL_RWops* rwops = SDL_RWFromFP(in, /*autoclose=*/1);
Thanks for finding the leak sources, this is much useful!
Apparently, the game was never coded with "restore" and "restart" in
mind, and I didn't either in my changes. I was wondering exactly when
sprites are reloaded (and memory leaked), since dink.ini is only
processed once. Afaics this happened whenever there's a "init()" line
in a DinkC script, which Pilgrim Quests does a lot in ESCAPE.C
(restart game) and the various item scripts (which means there were
leaks whenever an item is selected or changed). This only applies to
non-dir.ff graphics though, I'm gonna check carefully how you solved
the cur_sprite issue and how this differs from load_sprite_pak().
Similarly, sounds are reloaded whenever the game is restarted because
the START.C script is launched.
Eventually, I guess the game internals also need new partial (non-SDL)
*_init and *_quit functions, that would be called whenever the game is
reloaded or restarted, and would clean-up the game resources without
quitting SDL.
> Now my xbox port has 30 MBs free when starting the original Dink
> Smallwood game and, so far, I haven't detected more big memory leaks :)
What are you plans with this port btw?
Can I mention it?
Cheers,
--
Sylvain
Message not available