If you have a small sample that demonstrates the problem that seems perfect for b.android.com.
On Dec 17, 6:01 pm, "B++" <bet...@gmail.com> wrote: > After some further analysis, it seems that the problem lies on the > DexFile. The PathClassLoader internally invokes the DexFile which > apparently unzips the package to retrieve the class. However, these > resources don't seem to be released. > > B. > > On Dec 17, 3:45 pm, "B++" <bet...@gmail.com> wrote: > > > Thanks for the response. > > > I have already run it using hprof and mat, and located the issue, and > > the problem lies in here: > > onCreate(..) { > > ... > > PathClassLoader classLoader = new PathClassLoader("/path/to/apk.apk", > > getClassLoader()); > > classLoader.loadClass("path.to.class"); > > classLoader = null; > > > } > > > Only these three lines will cause a "leak" if you keep on creating > > this activity and destroying it with the back button. > > The class is getting loaded successfully, but the resources are never > > released. As you can see, I set the reference of the classLoader to > > null, and I never instantiate any object using the loaded class, but > > the problem still persists. > > > I have isolated the code as above, and you can clearly see that the > > memory is growing. > > > Can the getClassLoader() reference create a problem here? > > > Thanks > > > B. > > > On Dec 17, 2:57 pm, fadden <fad...@android.com> wrote: > > > > On Dec 17, 7:45 am, "B++" <bet...@gmail.com> wrote: > > > > > The problem is that this happens even if no objects are instantiated > > > > using the loaded class. There seems a problem with garbage collector, > > > > which doesn't seem to release resources about the loaded class on > > > > Destroy even if there are no references to it. > > > > It usually turns out that something is holding a reference to whatever > > > it is that isn't getting thrown away. The best way to figure this out > > > is to get the HPROF output and run it through jhat or MAT. > > > > See also: > > > http://android-developers.blogspot.com/2009/01/avoiding-memory-leaks.... > > > http://android.git.kernel.org/?p=platform/dalvik.git;a=blob_plain;f=d... > > > http://kohlerm.blogspot.com/ > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en