Slick Forums

Discuss the Slick 2D Library
It is currently Sun Jan 19, 2020 11:09 am

All times are UTC

Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu Dec 09, 2010 6:41 pm 

Joined: Sun Nov 26, 2006 6:56 pm
Posts: 37
Doing a Graphics.pushTransform() in the render loop of a slick program but forgetting to do a Graphics.popTransform() will eventually use up all available memory.

While this is fairly natural, I think it might be a good idea for slick to handle this somehow (took us a little while to locate the issue). Perhaps slick should throw an error once the number of transforms in the transform stack gets too large?

Another option, suggested by MatthiasM, is to force a transform stack size of 1 on return of the render loop. By doing this we could ensure we're not leaking memory or messing up the transform.

On the other hand, it may cause existing applications that do not leak memory (because they call resetTransform() at the start of the render loop) to stop working. Simply calling resetTransform() from within Slick once the render loop returns if the stack size is greater than 1 may also do the trick.

I'm not sure which solution is better (I don't know if one would ever want to leave a larger stack for a later render loop, but I suppose it *could* happen...)

 Post subject:
PostPosted: Wed Mar 09, 2011 2:02 pm 
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
Resolved in SVN.


Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group