|
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...)
|