-
Notifications
You must be signed in to change notification settings - Fork 30.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: general improvements to v8.md copy #6829
Closed
Closed
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,29 @@ | ||
# V8 | ||
|
||
Stability: 2 - Stable | ||
The `v8` module exposes APIs that are specific to the version of [V8][] | ||
built into the Node.js binary. It can be accessed using: | ||
|
||
This module exposes events and interfaces specific to the version of [V8][] | ||
built with Node.js. These interfaces are subject to change by upstream and are | ||
therefore not covered under the stability index. | ||
```js | ||
const v8 = require('v8'); | ||
``` | ||
|
||
The APIs and implementation are subject to change at any time. | ||
|
||
## v8.getHeapStatistics() | ||
<!-- YAML | ||
added: v1.0.0 | ||
--> | ||
|
||
Returns an object with the following properties | ||
Returns an object with the following properties: | ||
|
||
* `total_heap_size` {number} | ||
* `total_heap_size_executable` {number} | ||
* `total_physical_size` {number} | ||
* `total_available_size` {number} | ||
* `used_heap_size` {number} | ||
* `heap_size_limit` {number} | ||
|
||
For example: | ||
|
||
```js | ||
{ | ||
|
@@ -30,11 +42,19 @@ added: v6.0.0 | |
--> | ||
|
||
Returns statistics about the V8 heap spaces, i.e. the segments which make up | ||
the V8 heap. Order of heap spaces nor availability of a heap space can be | ||
guaranteed as the statistics are provided via the V8 `GetHeapSpaceStatistics` | ||
function. | ||
the V8 heap. Neither the ordering of heap spaces, nor the availability of a | ||
heap space can be guaranteed as the statistics are provided via the V8 | ||
`GetHeapSpaceStatistics` function and may change from one V8 version to the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we give a link here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea. |
||
next. | ||
|
||
The value returned is an array of objects containing the following properties: | ||
* `space_name` {string} | ||
* `space_size` {number} | ||
* `space_used_size` {number} | ||
* `space_available_size` {number} | ||
* `physical_space_size` {number} | ||
|
||
Example result: | ||
For example: | ||
|
||
``` | ||
[ | ||
|
@@ -81,9 +101,10 @@ Example result: | |
added: v1.0.0 | ||
--> | ||
|
||
Set additional V8 command line flags. Use with care; changing settings | ||
The `v8.setFlagsFromString()` method can be used to programmatically set | ||
V8 command line flags. This method should be used 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. | ||
crashes and data loss; or it may simply do nothing. | ||
|
||
The V8 options available for a version of Node.js may be determined by running | ||
`node --v8-options`. An unofficial, community-maintained list of options | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It actually means that it can have breaking changes even in minor version bumps, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe so, yes.