FrenchYeti / dexcalibur

[Official] Android reverse engineering tool focused on dynamic instrumentation automation leveraging Frida. It disassembles dex, analyzes it statically, generates hooks, discovers reflected methods, stores intercepted data and does new things from it. Its aim is to be an all-in-one Android reverse engineering platform.
Apache License 2.0
1.06k stars 126 forks source link

JavaScript heap out of memory #59

Open m2sup3rn0va opened 3 years ago

m2sup3rn0va commented 3 years ago

Hi

While scanning the apk, I am getting this error. Due to security issues, I can't share the complete stack trace but some of the error snippets are

[INFO] [INSPECTOR MANAGER] Project[**APK_NAME**], Step[POST_PLATFORM_SCAN] deploying inspectors : <none>
[INFO] Scanning default path : /root/dexcaliburWS/**APK**/apk

<--- Last few GCs --->

[398:0x4758e90]    82147 ms: Mark-sweep 2040.1 (2057.5) -> 2038.1 (2058.0) MB, 2531.6 / 0.0 ms  (average mu = 0.137, current mu = 0.066) allocation failure scavenge might not succeed
[398:0x4758e90]    84066 ms: Mark-sweep 2040.9 (2058.2) -> 2039.3 (2059.5) MB, 1736.4 / 0.0 ms  (average mu = 0.117, current mu = 0.095) allocation failure scavenge might not succeed

<--- JS stacktrace --->

==== JS stack trace =========================================

0: ExitFrame [pc: 0x140dcd9]
Security context: 0x1989a9dc08d1 <JSObject>
1: method [0x3817beb8ca81] [/usr/lib/node_modules/dexcalibur/src/SmaliParser.js:~373] [pc=0xcc232e1c3c2](this=0x2fa551ac5a49 <SmaliParser map = 0xc6671e13c19>,0x3ba9381d2311 <JSArray[2]>,0x3ba9381c9ec9 <String[11]: .end method>,67)
2: parse [0x3817beb8caf1] [/usr/lib/node_modules/dexcalibur/src/SmaliParser.js:~703] [pc=0xcc232d8351e](this=0x2fa551ac5a49 <...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

After this, I even tried node /usr/lib/node_modules/dexcalibur/dexcalibur.js --max-old-space-size=8192, but still no luck.

Please do let me know if I am doing anything wrong.

Also, this is running inside docker but I am getting similar error if I install dexcalibur in VM as well.

D-Sinus commented 3 years ago

Have you tried: [node --max-old-space-size=8192 /usr/lib/node_modules/dexcalibur/dexcalibur.js]

I'm using Windows 10 now, but strangely the heap size does not increased when the --max-old-space-size option used at the back of the location of the javascript file.

I suggests you to check whether [Mark-sweep 2040.1 (2057.5) -> 2038.1 (2058.0) MB] is increased to 8192MB when you tried [node /usr/lib/node_modules/dexcalibur/dexcalibur.js --max-old-space-size=8192]