Friday, August 19, 2011

[android-developers] Re: DexClassLoader and DexFile Leaking File Handles

On Thursday, August 18, 2011 1:49:34 PM UTC-4, Matt wrote:
while (true) {
    Copy plugin jar from assets to temp directory
    Create a DexClassLoader using plugin jar as the classpath
    Load plugin using this class loader
    Delete plugin jar from temp directory
}

Eventually, creating the DexClassLoader fails due to lack of disk
space.

I'd try to avoid copying and deleting the file each time, at least if it's the same file. 
 
Or do I just have to hope that in the real world, my
application's process gets restarted often enough that I won't hit
this problem?

It's interesting to think about how the activity lifecycle and things like orientation changes mean you process often gets terminated and then recreated, in a way that's supposed to be invisible to the user.  I wonder if there's a reliable way to cause that to happen?  It might be worth looking into. 

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment