I have developed a game consisting of about 25 activities. The app works like following:
(1.) open a menu, click play
(2.) open a new activity, click ok --> randomly pick which game (activity) to start
(3.) starts new game (activity)
the game activity loads and use some bitmaps (from start_Activity) and typically use 2-10mb of memory (according to debugger, no filter)
when game is completed (won or lost), i call Activity.finish and return to (2.) (above)
then I from (2.) can run a new randomly picked activity and so on
My problem is that for every "first time" a new activity is run, the Heap is increasing and does never go back down again. My plan was that (1.) and (2.) was to be in the memory while the random activity was to be loaded into memory and then removed again when calling activity.finish (and not continue accumulating...)
All bitmaps are loaded with loadbitmapsample and/or initialized by initializesample
All timers and mediaplayers are put under Process_Globals and only initialized when FirstTime = True
I've tried
- recycling bitmaps
- removeallviews
- set backgroundpicture to Null when finished
After some 5-10 minutes, it crash due to outofmemory - what can be the memory leak?
Any help is appreciated
(1.) open a menu, click play
(2.) open a new activity, click ok --> randomly pick which game (activity) to start
(3.) starts new game (activity)
the game activity loads and use some bitmaps (from start_Activity) and typically use 2-10mb of memory (according to debugger, no filter)
when game is completed (won or lost), i call Activity.finish and return to (2.) (above)
then I from (2.) can run a new randomly picked activity and so on
My problem is that for every "first time" a new activity is run, the Heap is increasing and does never go back down again. My plan was that (1.) and (2.) was to be in the memory while the random activity was to be loaded into memory and then removed again when calling activity.finish (and not continue accumulating...)
All bitmaps are loaded with loadbitmapsample and/or initialized by initializesample
All timers and mediaplayers are put under Process_Globals and only initialized when FirstTime = True
I've tried
- recycling bitmaps
- removeallviews
- set backgroundpicture to Null when finished
After some 5-10 minutes, it crash due to outofmemory - what can be the memory leak?
Any help is appreciated
Last edited: