v8
7.9.317 (node 13.2.0)
V8 is Google's open source JavaScript engine
|
#include <v8.h>
A set of constraints that specifies the limits of the runtime's memory use. You must set the heap size before initializing the VM - the size cannot be adjusted after the VM is initialized.
If you are using threads then you should hold the V8::Locker lock while setting the stack limit and you must set a non-default stack limit separately for each thread.
The arguments for set_max_semi_space_size, set_max_old_space_size, set_max_executable_size, set_code_range_size specify limits in MB.
The argument for set_max_semi_space_size_in_kb is in KB.
|
inline |
|
inline |
void ConfigureDefaults | ( | uint64_t | physical_memory, |
uint64_t | virtual_memory_limit | ||
) |
Configures the constraints with reasonable default values based on the capabilities of the current device the VM is running on.
physical_memory | The total amount of physical memory on the current device, in bytes. |
virtual_memory_limit | The amount of virtual memory on the current device, in bytes, or zero, if there is no limit. |
void ConfigureDefaultsFromHeapSize | ( | size_t | initial_heap_size_in_bytes, |
size_t | maximum_heap_size_in_bytes | ||
) |
Configures the constraints with reasonable default values based on the provided heap size limit. The heap size includes both the young and the old generation.
initial_heap_size_in_bytes | The initial heap size or zero. By default V8 starts with a small heap and dynamically grows it to match the set of live objects. This may lead to ineffective garbage collections at startup if the live set is large. Setting the initial heap size avoids such garbage collections. Note that this does not affect young generation garbage collections. |
maximum_heap_size_in_bytes | The hard limit for the heap size. When the heap size approaches this limit, V8 will perform series of garbage collections and invoke the NearHeapLimitCallback. If the garbage collections do not help and the callback does not increase the limit, then V8 will crash with V8::FatalProcessOutOfMemory. |
|
inline |
|
inline |
The maximum size of the old generation. When the old generation approaches this limit, V8 will perform series of garbage collections and invoke the NearHeapLimitCallback. If the garbage collections do not help and the callback does not increase the limit, then V8 will crash with V8::FatalProcessOutOfMemory.
size_t max_semi_space_size_in_kb | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
void set_max_semi_space_size_in_kb | ( | size_t | limit_in_kb | ) |
|
inline |
|
inline |