Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JavaScript heap out of memory #141

Open
lbois opened this issue Mar 22, 2018 · 3 comments
Open

JavaScript heap out of memory #141

lbois opened this issue Mar 22, 2018 · 3 comments

Comments

@lbois
Copy link

lbois commented Mar 22, 2018

I'm trying to convert a KML file that is 107 mb to geojson using the command line. It's a geospatial dataset from DATA.GOV about airports in the US. I installed togeojson with npm install -g @mapbox/togeojson . I'm on Mac OS High Sierra npm 5.7.1 node v8.9.4. Does anyone know how to fix the following error I'm getting Or is the KML file too big?

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [/usr/local/bin/node]
2: node::FatalException(v8::Isolate*, v8::Localv8::Value, v8::Localv8::Message) [/usr/local/bin/node]
3: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/usr/local/bin/node]
4: v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/usr/local/bin/node]
5: v8::internal::Runtime_AllocateInTargetSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
6: 0x4994fb8463d
7: 0x4994fd364e7
8: 0x4994fd2301f
Abort trap: 6

And the output file gives the errors too

<--- Last few GCs --->

[94669:0x103001800] 24468 ms: Mark-sweep 1405.0 (1457.3) -> 1405.0 (1434.8) MB, 1996.4 / 0.0 ms (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 1996 ms) last resort GC in old space requested
[94669:0x103001800] 26579 ms: Mark-sweep 1405.0 (1434.8) -> 1405.0 (1434.8) MB, 2110.8 / 0.0 ms last resort GC in old space requested

<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x22c0ad225ee1
1: createElementNS [/usr/local/lib/node_modules/@mapbox/togeojson/node_modules/xmldom/dom.js:673] [pc=0x4994fd364e7](this=0x22c02f085481 ,namespaceURI=0x22c02f0853d9 <String[30]: http://www.opengis.net/kml/2.2>,qualifiedName=0x22c0cd45ff21 <String[10]: SchemaData>)
2: appendElement [/usr/local/lib/node_modules/@mapbox/togeojson/node_modules/xmldom/sax.js:
...

@nbunney
Copy link

nbunney commented Oct 1, 2018

I have a file that is 475MB that I need to convert... Hope you guys can get this updated. Much appreciated all you are doing, but it looks like PHP has Node.js whipped in dealing with KML files for now.

@spot13
Copy link

spot13 commented Sep 26, 2019

You can allocate more ram with the following command:

NODE_OPTIONS=--max_old_space_size=4096 togeojson [your command]

@matthewohreluy
Copy link

Did this work? I also have the same issue.

You can allocate more ram with the following command:

NODE_OPTIONS=--max_old_space_size=4096 togeojson [your command]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants