I have a memory allocation error while running an android app I am developing. This only happens when I rotate the screen repeatedly, each rotation resulting in a little more memory being leached until the app crashes.
I was kind of reluctant to make this post because the problem itself seems quite simple to solve (avoid static context references and static resource references, I think) but in the last 10 hours I've had no luck.
I've had a look at some heap dump files with MAT but have no idea what it all means, I'm a first time user of that.
I haven't posted any code as it's partially sensitive and I'm not sure which parts of the code to post so I will give a brief outline of it here.
The activity causing the problem instantiates a sound manager class but this class is instantiated within another activity also and causes no problems there. The UI is all created in XML and consists of 25 Button elements with the same 9patch background, 3 TextViews and a Coach with 5 images within.
The MAT says that suspect problem 1 is android.widget.FrameLayout and suspect problem 2 is byte []
Any help would be insanely appreciated and if any more information is required I'll go ahead and edit to include it.
Thank you so much, Tim.
After some more trial and error (commenting out every bit of code and introducing each part bit by bit) I learned that my problem was caused by this line, which related to Google AdMob interstitial ads:
interstitial.loadAd(adRequest);
changing the following line solved the issue:
interstitial = new InterstitialAd(this);
to
interstitial = new InterstitialAd(getApplicationContext());