Skip to content

Reduce memory usage of long-running tasks #2036

@wenshao

Description

@wenshao

When a task runs for a long time, it may require 4GB or even 8GB of memory, and switching models and resuming sessions can be very time-consuming. I hope qwen-code can reduce memory usage and improve the efficiency of resuming long sessions and switching models.

Below is an error message from qwen resume indicating insufficient memory.

<--- Last few GCs --->

[19320:0x558c2057de20]    37556 ms: Scavenge 2035.8 (2080.7) -> 2033.5 (2081.2) MB, 6.49 / 0.76 ms  (average mu = 0.214, current mu = 0.159) allocation failure; 
[19320:0x558c2057de20]    37578 ms: Scavenge 2036.6 (2081.2) -> 2034.6 (2082.7) MB, 8.83 / 0.62 ms  (average mu = 0.214, current mu = 0.159) allocation failure; 
[19320:0x558c2057de20]    37601 ms: Scavenge 2037.8 (2082.7) -> 2035.6 (2091.0) MB, 9.85 / 0.68 ms  (average mu = 0.214, current mu = 0.159) allocation failure; 


<--- JS stacktrace --->

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

 1: 0x7f2f32e3a908 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/lib/x86_64-linux-gnu/libnode.so.115]
 2: 0x7f2f333ebc30 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/lib/x86_64-linux-gnu/libnode.so.115]
 3: 0x7f2f333ebff5 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/lib/x86_64-linux-gnu/libnode.so.115]
 4: 0x7f2f335fa7c7  [/lib/x86_64-linux-gnu/libnode.so.115]
 5: 0x7f2f335fa84b  [/lib/x86_64-linux-gnu/libnode.so.115]
 6: 0x7f2f33611390 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*) [/lib/x86_64-linux-gnu/libnode.so.115]
 7: 0x7f2f33611e6a v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/lib/x86_64-linux-gnu/libnode.so.115]
 8: 0x7f2f336126ac v8::internal::Heap::CollectAllGarbage(int, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/lib/x86_64-linux-gnu/libnode.so.115]
 9: 0x7f2f33583238 v8::internal::StackGuard::HandleInterrupts() [/lib/x86_64-linux-gnu/libnode.so.115]
10: 0x7f2f33a1cce9 v8::internal::Runtime_StackGuard(int, unsigned long*, v8::internal::Isolate*) [/lib/x86_64-linux-gnu/libnode.so.115]
11: 0x7f2ed3299ef6 
Image

Metadata

Metadata

Assignees

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions