Hi,
I noticed the following that I find strange:
- a blank page uses about 7mb of the heap according to ddms
- navigating between two blank windows by opening the new one and closing the previous one slowly but surely increase the heap size.
Any ideas of the reason(s) of such behaviours?
Tks.
2 Answers
Francios, please tell us the details or you have been allocated an image to the imageview which is not going to release which will increase your heap size. As this type of issue majorly comes in two cases if you deal with images or sqlite database
Hi,
Thank you for your replies. I'll try and create a project with a subset of mine to illustrate my problem. I do use images and a sqlite database. I created a navcontroller whith back and menu buttons but I never have more than one windows open. When I open a new window, I close the previous one after recording its path and its arguments so I can call it back with the back button. The reason I did it this way is that I had memory issue when keeping all windows open. Indeed, my app uses many images.
So when I move from one window to another, I can see that the heap sizes do not add up and hence my previous window is closed and garbage collected. However, moving back and forth between windows does increase the heap size. So not everything is garbage collected.
I read some articles about closure and circular references. It seems, if I understood what I read, that if I use my windows variable within my event listener that I create a closure and that the variable in questions won't be garbage collected. So that may be the reason of the issue I encounter.
However, you talk about similar issues with images and sqlite. Can you tell me more or point me to some documentations?
Tks a lot.
Your Answer
Think you can help? Login to answer this question!