Re: [sdljava-users] Possible memory leak in SWIG_SDLVideo / SDL_Surface / SWIG_SDLImage (Ivan Z. Ga
Status: Beta
Brought to you by:
ivan_ganza
|
From: Jesper J. / S. G. <je...@so...> - 2006-09-24 19:48:36
|
Two other things for the wish list:
1) I am really missing the SDL Cursor routines.
2) My application had a lot of garbage collection pauses - I ran a
memory profile and found that the vast majority of memory allocation
was done in blitSurface in SDLSurface.java, where 1-2 SDLRect
instances are created for every blit. I tried modifying this to reuse
the same SDLRects, and this radically decreased the number of garbage
collections.
setClipRect also creates a new instance for every call, and can be
made to reuse the same instance.
I don't know how this fits with SWIG?
/**
* Cache for blitsurface
*/
private SDLRect blitsurfacecache_s=new SDLRect();
/**
* Cache for blitsurface
*/
private SDLRect blitsurfacecache_d=new SDLRect();
public int blitSurface(SDLRect src, SDLSurface dstSurface,
SDLRect dst) throws SDLException {
if(src == null) {
src = blitsurfacecache_s;
src.x=0;
src.y=0;
src.width=getWidth();
src.height=getHeight();
// new SDLRect(0, 0, getWidth(), getHeight());
}
if (dst == null) {
dst = blitsurfacecache_d;
dst.x=0;
dst.y=0;
dst.width=-1;
dst.height=-1;
//dst = new SDLRect(0, 0, -1, -1);
}
return SWIG_SDLVideo.SWIG_SDL_BlitSurface_FAST(swigSurface,
src.getX(),
src.getY(),
src.getWidth(),
src.getHeight(),
dstSurface.getSwigSurface(),
dst.getX(),
dst.getY(),
dst.getWidth(),
dst.getHeight()
);
}
I will be happy to build the Windows binaries.
-Jesper
At 24-09-2006 15:15, Ivan wrote:
>I will fix all instances, thanks for pointing those out. I plan to do
>the fixes tomorrow at some point.
>
>Thanks for the wishlist, I agree we should find a way to get all that in.
>
>I remember adding code for YUV but I'm not really sure what YUV does so
>I don't know how to test it properly.
>
>The core dump problem on videoDriverName baffled me for a while, then I
>gave up to go to more important things, its quite strange.
>
>Regarding SDL_Sound I wasn't sure if people actually use it? Are people
>using this? And why would you use that instead of the Mixer?
>
>For Windows we just need to get into CVS the scripts that are needed to
>build the various binaries. Most of that is there already -- so there
>shouldn't be too much work. When we have a release someone needs to be
>so kind as to build me the binaries, and send them to me so I can add
>them to the release archive.
>
>-Ivan/
|