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: Ivan Z. G. <iva...@ya...> - 2006-09-26 01:02:09
|
Greetings Jesper, I will add the caching as you suggest. Thanks for point that out! I did only half the job I should have. At least on the C side it does using cached RECT's rather the making new ones. Now we'll do the same thing on the java side. We'll get those Cursor routines added as well. Really appreciate your offer of help with the binaries! Cheers, -Ivan/ Jesper Juul / Soup Games wrote: >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/ >> >> > > >------------------------------------------------------------------------- >Take Surveys. Earn Cash. Influence the Future of IT >Join SourceForge.net's Techsay panel and you'll get the chance to share your >opinions on IT & business topics through brief surveys -- and earn cash >http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >_______________________________________________ >sdljava-users mailing list >sdl...@li... >https://lists.sourceforge.net/lists/listinfo/sdljava-users > > |