Skip to content

Instantly share code, notes, and snippets.

@tcrowe
Created October 3, 2017 02:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tcrowe/1916a7c471e7bce4c1fd2bfe476771a8 to your computer and use it in GitHub Desktop.
Save tcrowe/1916a7c471e7bce4c1fd2bfe476771a8 to your computer and use it in GitHub Desktop.
Run node in a low memory or embedded environment (from 45MB normally to 14MB)
//
// node command-line arguments for making node run minimally in memory
//
let optiNodeArgs = [
// optimize for low memory system
'--optimize_for_size',
'--always_compact',
'--max_old_space_size=256',
// '--max_executable_size=300', // disabled in v8.x.x
// aggressive garbage collection
'--gc_interval=100', // what is the right interval value?
'--expose_gc', // call gc() function ad hoc
// es5 strict
'--use_strict',
'--no-harmony',
// debugging
// '--abort_on_uncaught_exception', // causes broken source map?
// '--abort_on_stack_overflow',
'--hard_abort'
]
@tcrowe
Copy link
Author

tcrowe commented Oct 3, 2017

No loss in speed was noticed in my load testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment