I have this problem Android: Screen orientation error + VM won't let us allocate x bytes so I decided to download Eclipse Memory Analyzer. I run it when my error is appearing and I have 3 problems suspects but I don't understand where it might come from. + I don't really know if my problem is due to a memory leak as the possible leaks take only 2.2;B space
PROBLEM SUSPECT 1
2,094 instances of "java.lang.Class", loaded by "<system class loader>" occupy 789,200 (33.76%) bytes.
Biggest instances:
•class android.text.Html$HtmlParser @ 0x4018d3f0 - 126,632 (5.42%) bytes.
•class org.apache.harmony.security.fortress.Services @ 0x400e2e58 - 53,880 (2.30%) bytes.
•class com.android.internal.R$styleable @ 0x400882c0 - 38,072 (1.63%) bytes.
•class libcore.icu.TimeZones$CachedTimeZones @ 0x40444fa8 - 37,712 (1.61%) bytes.
•class android.R$styleable @ 0x40055940 - 37,640 (1.61%) bytes.
•class android.content.res.Resources @ 0x40075178 - 36,032 (1.54%) bytes.
•class android.text.AutoText @ 0x40178980 - 31,656 (1.35%) bytes.
Keywords
java.lang.Class
PROBLEM SUSPECT 2
128 instances of "org.bouncycastle.jce.provider.X509CertificateObject", loaded by "<system class loader>" occupy 455,112 (19.47%) bytes. These instances are referenced from one instance of "java.util.Hashtable$HashtableEntry[]", loaded by "<system class loader>"
Keywords
org.bouncycastle.jce.provider.X509CertificateObject
java.util.Hashtable$HashtableEntry[]
PROBLEM SUSPECT 3
6,822 instances of "java.lang.String", loaded by "<system class loader>" occupy 418,104 (17.89%) bytes.
Keywords
java.lang.String
Do you think I have a leak? Can we say it from what I have posted? Thank you
On Android, I think it quite easy to leak an Activity context. So the most frequently way I used to find a memory leak, is to open an OQL tab, and input 'select * from instanceof android.app.Activity' . Then you could see how many Activity instances there, and you could tell whether there is a leak or not by your own judgement. Also you could right-click on one of the Activity instances, and click 'Path to GC'--> 'exclude all soft/weak/phantom references'. Then you could see the references to the Activity in chain. Good luck !