Skip to content

Instantly share code, notes, and snippets.

@zeke
Created January 10, 2018 04:40
Show Gist options
  • Save zeke/be521063146be0ec05049edb505e05c2 to your computer and use it in GitHub Desktop.
Save zeke/be521063146be0ec05049edb505e05c2 to your computer and use it in GitHub Desktop.
Running out of memory trying to create a leveldb
<--- Last few GCs --->
[6881:0x103000000] 34771 ms: Mark-sweep 1412.6 (1464.8) -> 1412.5 (1448.8) MB, 2903.0 / 0.0 ms (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 2903 ms) last resort
[6881:0x103000000] 37852 ms: Mark-sweep 1412.5 (1448.8) -> 1412.5 (1448.8) MB, 3081.4 / 0.0 ms last resort
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0xc56e9a1cef1 <JSObject>
1: /* anonymous */ [/Users/z/git/nice-registry/sourceranks/script/seed.js:~1] [pc=0x270c82c5578b](this=0x2bc139c78cb1 <Object map = 0x3cfd43f04829>,exports=0x2bc139c78cb1 <Object map = 0x3cfd43f04829>,require=0x2bc139c78c69 <JSFunction require (sfi = 0x18c6c30ad439)>,module=0x2bc139c78c19 <Module map = 0x3cfd43f41761>,__filename=0x18c6c30c1909 <String[53]: /Users/z/git/nice-registry/sourceran...
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::Local<v8::Value>, v8::Local<v8::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: 0x270c82b040dd
zsh: abort node script/seed.js
#!/usr/bin/env node
const names = require('all-the-package-names')
const level = require('level')
const db = level('./db')
for (name of names) {
addName(name)
}
async function addName (name) {
console.log(name)
const data = {
name: name,
updatedAt: null
}
await db.put(name, JSON.stringify(data, null, 2))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment