Re: [sdljava-users] Possible memory leak in SWIG_SDLVideo
Status: Beta
Brought to you by:
ivan_ganza
From: Jesper J. / S. G. <je...@so...> - 2006-09-17 19:15:16
|
I wanted to post about this for a long time - I agre there is a leak . So far I've worked around it by wrapping all Surfaces in a custom object that calls dispose() in the finalizer. -Jesper >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 |