Open shenbrun opened 3 years ago
2021 08 25
Looks like a memory leak, Server side
var doc = new PDFDocument({compress: true, size: 'A4', margin: 0});
for (var i = 0; i < 30000; i++){ doc.fontSize(8); doc.text('Mobile application', 90, 30); doc.addPage({compress: true, size: 'A4', margin: 0}); }
doc.end(); doc.pipe(res); // HTTP response
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 00007FF676573E0F napi_wrap+108911 2: 00007FF676517E16 v8::base::CPU::has_sse+61910 3: 00007FF676518D16 node::OnFatalError+294 4: 00007FF676DF0CEE v8::Isolate::ReportExternalAllocationLimitReached+94 5: 00007FF676DD5ACD v8::SharedArrayBuffer::Externalize+781 6: 00007FF676C7F95C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1516 7: 00007FF676C8ACEA v8::internal::Heap::ProtectUnprotectedMemoryChunks+1258 8: 00007FF676C87E99 v8::internal::Heap::PageFlagsAreConsistent+2457 9: 00007FF676C7CA71 v8::internal::Heap::CollectGarbage+2033 10: 00007FF676C7A7A0 v8::internal::Heap::AllocateExternalBackingStore+80 11: 00007FF676B9023D v8::internal::BackingStore::Allocate+205 12: 00007FF676D96292 v8::internal::Builtins::builtin_handle+290162 13: 00007FF676D94E5D v8::internal::Builtins::builtin_handle+284989 14: 00007FF676D94AE3 v8::internal::Builtins::builtin_handle+284099 15: 00007FF676E79C8D v8::internal::SetupIsolateDelegate::SetupHeap+465453 16: 00007FF676E0DF71 v8::internal::SetupIsolateDelegate::SetupHeap+23825 17: 00007FF676ED9200 v8::internal::SetupIsolateDelegate::SetupHeap+855968 18: 00007FF676E6EE52 v8::internal::SetupIsolateDelegate::SetupHeap+420850 19: 00007FF676E0DF71 v8::internal::SetupIsolateDelegate::SetupHeap+23825
i have found the same issue how do u solve this
Bug Report
2021 08 25
Description of the problem
Looks like a memory leak, Server side
Code sample
var doc = new PDFDocument({compress: true, size: 'A4', margin: 0});
for (var i = 0; i < 30000; i++){ doc.fontSize(8); doc.text('Mobile application', 90, 30); doc.addPage({compress: true, size: 'A4', margin: 0}); }
doc.end(); doc.pipe(res); // HTTP response
Your environment
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 00007FF676573E0F napi_wrap+108911 2: 00007FF676517E16 v8::base::CPU::has_sse+61910 3: 00007FF676518D16 node::OnFatalError+294 4: 00007FF676DF0CEE v8::Isolate::ReportExternalAllocationLimitReached+94 5: 00007FF676DD5ACD v8::SharedArrayBuffer::Externalize+781 6: 00007FF676C7F95C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1516 7: 00007FF676C8ACEA v8::internal::Heap::ProtectUnprotectedMemoryChunks+1258 8: 00007FF676C87E99 v8::internal::Heap::PageFlagsAreConsistent+2457 9: 00007FF676C7CA71 v8::internal::Heap::CollectGarbage+2033 10: 00007FF676C7A7A0 v8::internal::Heap::AllocateExternalBackingStore+80 11: 00007FF676B9023D v8::internal::BackingStore::Allocate+205 12: 00007FF676D96292 v8::internal::Builtins::builtin_handle+290162 13: 00007FF676D94E5D v8::internal::Builtins::builtin_handle+284989 14: 00007FF676D94AE3 v8::internal::Builtins::builtin_handle+284099 15: 00007FF676E79C8D v8::internal::SetupIsolateDelegate::SetupHeap+465453 16: 00007FF676E0DF71 v8::internal::SetupIsolateDelegate::SetupHeap+23825 17: 00007FF676ED9200 v8::internal::SetupIsolateDelegate::SetupHeap+855968 18: 00007FF676E6EE52 v8::internal::SetupIsolateDelegate::SetupHeap+420850 19: 00007FF676E0DF71 v8::internal::SetupIsolateDelegate::SetupHeap+23825