dragsystem / frozenbubbleplus

Automatically exported from code.google.com/p/frozenbubbleplus
0 stars 0 forks source link

Investigate potential memory leaks, especially in the music player #61

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
After playing for a while, a memory allocation will fail when creating a buffer 
to load a new music module file.  This is evinced by skipping or abnormal audio 
performance.  At this point, it appears that the available heap has shrunk to 
the point where the game may become unstable.

Investigate if there is a memory leak that is leading to heap issues, or if 
potentially we need to force garbage collection as there are often many large 
memory allocations in succession if levels are completed quickly, potentially 
before garbage collection will run of its own accord.

This is an issue in the current version, V2.3.

Original issue reported on code.google.com by forter...@gmail.com on 15 May 2014 at 1:32

GoogleCodeExporter commented 9 years ago
Furthermore, adding a cleanUp() method to FrozenGame.java that is called in 
GameView.java whenever an old FrozenGame object instance is no longer being 
used would be advisable.  Currently no cleanup of dyanmically allocated objects 
is performed except at the topmost level object in GameView.java.

For example, the Sprites and Vectors can all be null-ified, as well as the 
various other objects such as the BubbleSprite array, the Compressor, the 
BubbleManager, etc.

Original comment by forter...@gmail.com on 19 May 2014 at 2:13

GoogleCodeExporter commented 9 years ago
Fixed in version 3.2.  It was in jni_stubs.cpp - when copying bytes from a 
buffer with GetByteArrayElements(), the system will pin the memory so the 
garbage collector won't recycle it.  It needs to be unpinned via 
ReleaseByteArrayElements(), and can also then be deleted via DeleteLocalRef().

Original comment by forter...@gmail.com on 9 Jun 2014 at 9:58