Running out of memory error
jnucc86 opened this issue · comments
Hi Andrew, I'm trying to use this tool to add label points to a set of multipolygons in a geojson collection. File size is ~18mb but I am having issues where node seems to be running out of memory. The command I'm using is:
node --max_old_space_size=4096 ./node_modules/geojson-polygon-labels/bin/geojson-polygon-labels --precision=0.001 --label=polylabel --style=explode --include-minzoom=8 --verbose file.geojson > file2.geojson
Error I get is:
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
Writing Node.js report to file: report.20190620.130738.11321.0.001.json
Node.js report completed
1: 0x100077900 node::Abort() [/usr/local/bin/node]
2: 0x100077f7e node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
3: 0x100162795 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
4: 0x100162737 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
5: 0x100428cf9 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/bin/node]
6: 0x100429b8a v8::internal::Heap::HasLowYoungGenerationAllocationRate() [/usr/local/bin/node]
7: 0x100427fc1 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node]
8: 0x100426929 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
9: 0x10042d98c v8::internal::Heap::AllocateRawWithLightRetry(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [/usr/local/bin/node]
10: 0x10042d9d8 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [/usr/local/bin/node]
11: 0x10040defc v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/usr/local/bin/node]
12: 0x1005f8571 v8::internal::Runtime_AllocateInNewSpace(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
13: 0x100a91f82 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/bin/node]
14: 0x11952628b044
Abort trap: 6
The geojson contains geometries of forests extracted from OSM which I have simplified for ease of processing. The process just runs and runs with node taking up more and more memory until it hits the limit I set. Something seems off. Are you able to assist?
Are you using v1.3.0? In that release we added streams which should solve out of memory issues.
I installed using the npm install...
command as per the readme, it looks like v1.3.0 looking at the changelog file. I also tried again increasing the node memory allocation to 8GB and the node ram kept climbing up to around 7GB before I decided to kill it. Is it expected that a 18MB file requires that much ram to process?
okay, there must be an issue. please post back if you find out what the cause is, or feel free to submit a PR if you manage to fix it. 👍
Hi Andrew
I've solved this, turns out the input geometry was in CRS 3857 not 4326. Once fixed the module works well, and fast.
Cheers.