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

Error when merging multiple GeoJSON files. #28

Open
mutgard opened this issue Apr 27, 2018 · 1 comment
Open

Error when merging multiple GeoJSON files. #28

mutgard opened this issue Apr 27, 2018 · 1 comment

Comments

@mutgard
Copy link

mutgard commented Apr 27, 2018

I've tried a couple of things to merge ~2k files.
First thing I did was merging them on little groups of 100 so I get 20 files of around 30MB each and repeating this process until there is only one file. When I get to the last 4 of them it looks like it tries to take more memory than allowed and stops.
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory 1: node::Abort() [/usr/local/bin/node] 2: node::FatalTryCatch::~FatalTryCatch() [/usr/local/bin/node] 3: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/usr/local/bin/node] 4: v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [/usr/local/bin/node] 5: v8::internal::String::SlowFlatten(v8::internal::Handle<v8::internal::ConsString>, v8::internal::PretenureFlag) [/usr/local/bin/node] 6: v8::String::WriteUtf8(char*, int, int*, int) const [/usr/local/bin/node] 7: node::StringBytes::Write(v8::Isolate*, char*, unsigned long, v8::Local<v8::Value>, node::encoding, int*) [/usr/local/bin/node] 8: node::Buffer::New(v8::Isolate*, v8::Local<v8::String>, node::encoding) [/usr/local/bin/node] 9: node::Buffer::(anonymous namespace)::CreateFromString(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node] 10: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/usr/local/bin/node] 11: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node] 12: v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/bin/node] 13: 0x3a5bea4042fd 14: 0x3a5bea4bd196 sh: line 1: 4733 Abort trap: 6

The other thing I tried is using the -s option so it doesn't limit to the memory available but that gives me another error:
(node:4928) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 drain listeners added. Use emitter.setMaxListeners() to increase limit

Are there other ways I can follow to accomplish the same result?
My goal is to create an .mbtiles file

@space55
Copy link

space55 commented May 20, 2020

You should be able to fix this by adding

NODE_OPTIONS="--max-old-space-size=4096" <command>

--max-old-space-size=4096 measures maximum memory allocation in megabytes - so if you have less ram, decrease the argument as needed.

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

2 participants