2014-12-09 22:57:48 +01:00
|
|
|
# V8
|
|
|
|
|
2015-02-25 01:15:26 +01:00
|
|
|
Stability: 2 - Stable
|
2014-12-09 22:57:48 +01:00
|
|
|
|
|
|
|
This module exposes events and interfaces specific to the version of [V8][]
|
2015-02-07 11:25:13 +01:00
|
|
|
built with io.js. These interfaces are subject to change by upstream and are
|
2014-12-09 22:57:48 +01:00
|
|
|
therefore not covered under the stability index.
|
|
|
|
|
2014-12-23 17:07:31 +01:00
|
|
|
## getHeapStatistics()
|
2014-12-09 22:57:48 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2014-12-23 17:07:31 +01:00
|
|
|
## setFlagsFromString()
|
2014-12-09 22:57:48 +01:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2015-02-07 11:25:13 +01:00
|
|
|
The V8 options available for a version of io.js may be determined by running
|
2014-12-09 22:57:48 +01:00
|
|
|
`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/
|