Hello everyone, Hello Ivan,
I was wondering a long time why my application needs more and more RAM.
I took a while to track down a possible memory leak.
It seems to be located in sdljava.x.swig.SWIG_SDLVideo .
The following methods seems to be affected:
SDL_ConvertSurface(), SDL_DisplayFormat() and SDL_DisplayFormatAlpha()
I am not sure at the moment, but maybe other methods have the same problem:
SDL_SetVideoMode(), SDL_CreateRGBSurface(), SWIG_SDL_LoadBMP(),
SWIG_SDL_CreateRGBSurfaceFrom()
Please have a look at the last line of all methods:
return (cPtr == 0) ? null : new SDL_Surface(cPtr, false);
As you can easily see, false indicates that the new surface cannot free
the memory because some other surface seems to also use it. But this is
not true, the surface has just been created, no other surface does own
this memory area.
So this bug should be fixed when setting the second argument of the
surface constructors to true.
Ivan, would you please verify the problem?
Thank you.
Best Regards,
Patric
|