Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hoangpq/07d67b9eb09ceb7510c042325fc5d083 to your computer and use it in GitHub Desktop.
Save hoangpq/07d67b9eb09ceb7510c042325fc5d083 to your computer and use it in GitHub Desktop.
Node V8 GC-related options
--log_gc (Log heap samples on garbage collection for the hp2ps tool.)
type: bool default: false
--expose_gc (expose gc extension)
type: bool default: false
--max_new_space_size (max size of the new generation (in kBytes))
type: int default: 0
--max_old_space_size (max size of the old generation (in Mbytes))
type: int default: 0
--max_executable_size (max size of executable memory (in Mbytes))
type: int default: 0
--gc_global (always perform global GCs)
type: bool default: false
--gc_interval (garbage collect after <n> allocations)
type: int default: -1
--trace_gc (print one trace line following each garbage collection)
type: bool default: false
--trace_gc_nvp (print one detailed trace line in name=value format after each garbage collection)
type: bool default: false
--trace_gc_ignore_scavenger (do not print trace line after scavenger collection)
type: bool default: false
--print_cumulative_gc_stat (print cumulative GC statistics in name=value format on exit)
type: bool default: false
--trace_gc_verbose (print more details following each garbage collection)
type: bool default: false
--trace_fragmentation (report fragmentation for old pointer and data pages)
type: bool default: false
--trace_external_memory (print amount of external allocated memory after each time it is adjusted.)
type: bool default: false
--collect_maps (garbage collect maps from which no objects can be reached)
type: bool default: true
--flush_code (flush code that we expect not to use again before full gc)
type: bool default: true
--incremental_marking (use incremental marking)
type: bool default: true
--incremental_marking_steps (do incremental marking steps)
type: bool default: true
--trace_incremental_marking (trace progress of the incremental marking)
type: bool default: false
--track_gc_object_stats (track object counts and memory usage)
type: bool default: false
--use_idle_notification (Use idle notification to reduce memory footprint.)
type: bool default: true
--use_ic (use inline caching)
type: bool default: true
--native_code_counters (generate extra code for manipulating stats counters)
type: bool default: false
--always_compact (Perform compaction on every full GC)
type: bool default: false
--lazy_sweeping (Use lazy sweeping for old pointer and data spaces)
type: bool default: true
--never_compact (Never perform compaction on full GC - testing only)
type: bool default: false
--compact_code_space (Compact code space on full non-incremental collections)
type: bool default: true
--incremental_code_compaction (Compact code space on full incremental collections)
type: bool default: true
--cleanup_code_caches_at_gc (Flush inline caches prior to mark compact collection and flush code caches in maps during mark compact cycle.)
type: bool default: true
$ node --expose-gc --trace-gc --log-gc
[40433] 1397730668633 ms: Mark-sweep 0.5 (34.0) -> 0.5 (34.0) MB, 0 ms [Logger::LogCodeObjects] [GC in old space requested].
[40433] 1397730668633 ms: Mark-sweep 0.5 (34.0) -> 0.4 (34.0) MB, 0 ms [Logger::LogCompiledFunctions] [GC in old space requested].
> var a = [];
[40433] 5200 ms: Scavenge 2.6 (37.0) -> 2.4 (37.0) MB, 1 ms [Runtime::PerformGC].
undefined
> for (var i = 0; i < 10000; i++) a.push('' + i);
[40433] 42607 ms: Scavenge 3.6 (38.0) -> 3.2 (39.0) MB, 0 ms [Runtime::PerformGC].
10000
> a.length
10000
> a = null;
null
> global.gc();
[40433] 68105 ms: Mark-sweep 3.6 (39.0) -> 2.8 (39.0) MB, 4 ms [gc extension] [GC in old space requested].
undefined
>
(^C again to quit)
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment