ol-th / pdf-img-convert.js

Simple node package to convert a PDF into images.
MIT License
161 stars 38 forks source link

memory leak problem with larger in size or the files with many page #34

Closed jwadulhssn closed 1 year ago

jwadulhssn commented 1 year ago

<--- Last few GCs --->

[55692:0x6b35cb0] 18711 ms: Mark-sweep (reduce) 29.5 (49.9) -> 29.4 (32.6) MB, 22.0 / 0.0 ms (average mu = 0.892, current mu = 0.001) external memory pressure GC in old space requested [55692:0x6b35cb0] 18726 ms: Mark-sweep (reduce) 29.4 (32.6) -> 29.3 (31.9) MB, 14.7 / 0.0 ms (average mu = 0.818, current mu = 0.003) external memory pressure GC in old space requested

<--- JS stacktrace --->

FATAL ERROR: v8::ArrayBuffer::New Allocation failed - process out of memory 1: 0xb06730 node::Abort() [node] 2: 0xa1b6d0 [node] 3: 0xce1e60 v8::Utils::ReportOOMFailure(v8::internal::Isolate, char const, bool) [node] 4: 0xce2207 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate, char const, bool) [node] 5: 0xce22eb [node] 6: 0xcf2f25 [node] 7: 0x7fd851c39634 Context2d::GetImageData(Nan::FunctionCallbackInfo const&) [path_to_project/node_modules/canvas/build/Release/canvas.node] 8: 0x7fd851c2ae58 [path_to_project/node_modules/canvas/build/Release/canvas.node] 9: 0xd3e3ce [node] 10: 0xd3f7ef v8::internal::Builtin_HandleApiCall(int, unsigned long, v8::internal::Isolate) [node] 11: 0x15da239 [node] Aborted (core dumped)

vbxcoder commented 1 year ago

@jwadulhssn Can you provide sample PDF file which is causing memory leak, Now I made some changes and I could convert 40 Mb file with 312 pages

jwadulhssn commented 1 year ago

Hey @vbxcoder, it was just a guess about the problem we were facing. Later on faced same for the PDFs with smaller font size or if there is no text on the page and just an image. But it was not a problem with no. of pages.