APKParser icon indicating copy to clipboard operation
APKParser copied to clipboard

OutOfMemoryError for when VM heap is too low

Open AndroidDeveloperLB opened this issue 9 years ago • 2 comments

If the VM heap is 32MB, and you try to load the app of package name "android" (app label is "Android System") and you run it on the emulator, it gets an OOM:

Caused by: java.lang.OutOfMemoryError at com.jaredrummler.apkparser.parser.ResourceTableParser.readPackage(ResourceTableParser.java:119) at com.jaredrummler.apkparser.parser.ResourceTableParser.parse(ResourceTableParser.java:67) at com.jaredrummler.apkparser.ApkParser.parseResourceTable(ApkParser.java:417) at com.jaredrummler.apkparser.ApkParser.transBinaryXml(ApkParser.java:269) at com.jaredrummler.apkparser.ApkParser.parseManifestXml(ApkParser.java:207) at com.jaredrummler.apkparser.ApkParser.parseApkMeta(ApkParser.java:199) at com.jaredrummler.apkparser.ApkParser.getApkMeta(ApkParser.java:150) at com.jaredrummler.apkparser.ApkParser.getAndroidManifest(ApkParser.java:140)

Is there a way to overcome this? To somehow minimize memory usage further?

AndroidDeveloperLB avatar Jul 24 '16 21:07 AndroidDeveloperLB

I don't have the time to look into this but PR are welcome.

jaredrummler avatar Jul 30 '16 13:07 jaredrummler

Do you know perhaps what takes so much memory? It just parses APK files, and even then, just tiny stuff from there, no?

AndroidDeveloperLB avatar Jul 30 '16 15:07 AndroidDeveloperLB