mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
db595b2de6
I introduced this module over a year ago in a pull request as the v8 module but it was quickly subsumed by the tracing module. The tracing module was recently removed again and that is why this commit introduces the v8 module again, including the new features it picked up commitsd23ac0e
andf8076c4
. PR-URL: https://github.com/iojs/io.js/pull/131 Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com> Reviewed-By: Christian Tellnes <christian@tellnes.no> Reviewed-By: Thorsten Lorenz <thlorenz@gmx.de> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
44 lines
1.2 KiB
Markdown
44 lines
1.2 KiB
Markdown
# V8
|
|
|
|
Stability: 1 - Experimental
|
|
|
|
This module exposes events and interfaces specific to the version of [V8][]
|
|
built with node. These interfaces are subject to change by upstream and are
|
|
therefore not covered under the stability index.
|
|
|
|
### getHeapStatistics()
|
|
|
|
Returns an object with the following properties
|
|
|
|
```
|
|
{
|
|
total_heap_size: 7326976,
|
|
total_heap_size_executable: 4194304,
|
|
total_physical_size: 7326976,
|
|
used_heap_size: 3476208,
|
|
heap_size_limit: 1535115264
|
|
}
|
|
```
|
|
|
|
### setFlagsFromString()
|
|
|
|
Set additional V8 command line flags. Use with care; changing settings
|
|
after the VM has started may result in unpredictable behavior, including
|
|
crashes and data loss. Or it may simply do nothing.
|
|
|
|
The V8 options available for a version of node may be determined by running
|
|
`iojs --v8-options`. An unofficial, community-maintained list of options
|
|
and their effects is available
|
|
[here](https://github.com/thlorenz/v8-flags/blob/master/flags-0.11.md).
|
|
|
|
Usage:
|
|
|
|
```
|
|
// Print GC events to stdout for one minute.
|
|
var v8 = require('v8');
|
|
v8.setFlagsFromString('--trace_gc');
|
|
setTimeout(function() { v8.setFlagsFromString('--notrace_gc'); }, 60e3);
|
|
```
|
|
|
|
[V8]: https://code.google.com/p/v8/
|