Skip to content

Improve memory usage for big scripts #204

@wavedevgit

Description

@wavedevgit

Describe the bug

WebCrack crashes due to a memory leak when I try to load web.js (its a big file) from canary.discord.com/app

Expected Behaviour

Should avoid memory leaks and work normally

Code

https://canary.discord.com/assets/web.e379f5893cb32b3b.js

Logs

wavedev@wavedev-computer:~/discord-chunks-datamining$ webcrack .js -o test
  webcrack:transforms prepare: started +0ms

<--- Last few GCs --->

[8298:0x2d090000]    10550 ms: Scavenge 2023.6 (2082.8) -> 2021.2 (2086.2) MB, pooled: 0 MB, 4.89 / 0.00 ms  (average mu = 0.483, current mu = 0.303) allocation failure; 
[8298:0x2d090000]    10567 ms: Scavenge 2026.9 (2086.2) -> 2023.7 (2103.8) MB, pooled: 0 MB, 9.07 / 0.00 ms  (average mu = 0.483, current mu = 0.303) allocation failure; 


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

 1: 0xe40d2e node::OOMErrorHandler(char const*, v8::OOMDetails const&) [node]
 2: 0x12167b0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
 3: 0x1216a87 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
 4: 0x1444365  [node]
 5: 0x145dbf9 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
 6: 0x14322a8 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
 7: 0x14331d5 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
 8: 0x140beae v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
 9: 0x186d50c v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
10: 0x752ef9e6c476

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions