Konloch / Konloch/bytecode-viewer

Exception in thread "Import Resource" java.lang.OutOfMemoryError: Java heap space

Open
#407 3 comments 1 reaction 0 assignees View on GitHub
Bug
Dominant language
Java
Stars
15.6k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

I wanted to take a look to the source code of State of Survival, alas the decompilation failed.
```
Opening...D:\Apps\state-of-survival-1-14-46.apk
I: Using Apktool 2.6.0 on bVKcmpSfEapXHfazxdtrWHYfwnrehQBa.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\aquilax007\.Bytecode-Viewer\bcv_temp\beMallVisKSP\1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Baksmaling classes2.dex...
I: Baksmaling classes3.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
I: Copying META-INF/services directory
Exception in thread "Import Resource" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Unknown Source)
at java.io.ByteArrayOutputStream.grow(Unknown Source)
at java.io.ByteArrayOutputStream.ensureCapacity(Unknown Source)
at java.io.ByteArrayOutputStream.write(Unknown Source)
at the.bytecode.club.bytecodeviewer.util.MiscUtils.getBytes(MiscUtils.java:343)
at the.bytecode.club.bytecodeviewer.util.JarUtils.loadResources(JarUtils.java:216)
at the.bytecode.club.bytecodeviewer.resources.importing.impl.APKResourceImporter.open(APKResourceImporter.java:56)
at the.bytecode.club.bytecodeviewer.resources.importing.ImportResource.importKnownFile(ImportResource.java:87)
at the.bytecode.club.bytecodeviewer.resources.importing.ImportResource.run(ImportResource.java:59)
at java.lang.Thread.run(Unknown Source)
```

Contributor guide

Open the contributing guide

Research direction

Start with APKResourceImporter.open, then trace JarUtils.loadResources and MiscUtils.getBytes at the reported stack frames. Reproduce the import with the State of Survival APK or another large APK and inspect where resource bytes accumulate. Done means the resource import completes without the Java heap-space failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
performance, reverse-engineering, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.