pub struct CreateParams { /* private fields */ }Expand description
Initial configuration parameters for a new Isolate.
Implementations§
Source§impl CreateParams
impl CreateParams
Sourcepub fn counter_lookup_callback(
self,
callback: unsafe extern "C" fn(name: *const char) -> *mut i32,
) -> Self
pub fn counter_lookup_callback( self, callback: unsafe extern "C" fn(name: *const char) -> *mut i32, ) -> Self
Enables the host application to provide a mechanism for recording statistics counters.
Sourcepub fn snapshot_blob(self, data: StartupData) -> Self
pub fn snapshot_blob(self, data: StartupData) -> Self
Explicitly specify a startup snapshot blob.
Sourcepub fn array_buffer_allocator(
self,
array_buffer_allocator: impl Into<SharedPtr<ArrayBufferAllocator>>,
) -> Self
pub fn array_buffer_allocator( self, array_buffer_allocator: impl Into<SharedPtr<ArrayBufferAllocator>>, ) -> Self
The ArrayBuffer::ArrayBufferAllocator to use for allocating and freeing the backing store of ArrayBuffers.
Sourcepub fn has_set_array_buffer_allocator(&self) -> bool
pub fn has_set_array_buffer_allocator(&self) -> bool
Check if array_buffer_allocator has already been called. Useful to some
embedders that might want to set an allocator but not overwrite if one
was already set by a user.
Sourcepub fn external_references(
self,
ext_refs: Cow<'static, [ExternalReference]>,
) -> Self
pub fn external_references( self, ext_refs: Cow<'static, [ExternalReference]>, ) -> Self
Specifies an optional nullptr-terminated array of raw addresses in the embedder that V8 can match against during serialization and use for deserialization. This array and its content must stay valid for the entire lifetime of the isolate.
Sourcepub fn allow_atomics_wait(self, value: bool) -> Self
pub fn allow_atomics_wait(self, value: bool) -> Self
Whether calling Atomics.wait (a function that may block) is allowed in this isolate. This can also be configured via SetAllowAtomicsWait.
Sourcepub fn heap_limits(self, initial: usize, max: usize) -> Self
pub fn heap_limits(self, initial: usize, max: usize) -> Self
Configures the constraints with reasonable default values based on the provided lower and upper bounds.
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.
When the heap size approaches max, 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.
The heap size includes both the young and the old generation.
§Arguments
initial- The initial heap size or zero in bytesmax- The hard limit for the heap size in bytes
Sourcepub fn heap_limits_from_system_memory(
self,
physical_memory: u64,
virtual_memory_limit: u64,
) -> Self
pub fn heap_limits_from_system_memory( self, physical_memory: u64, virtual_memory_limit: u64, ) -> Self
Configures the constraints with reasonable default values based on the capabilities of the current device the VM is running on.
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.
When the heap size approaches its maximum, 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.
§Arguments
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.
Sourcepub fn max_old_generation_size_in_bytes(&self) -> usize
pub fn max_old_generation_size_in_bytes(&self) -> usize
Returns the maximum size of the old generation in bytes.
Sourcepub fn set_max_old_generation_size_in_bytes(self, limit: usize) -> Self
pub fn set_max_old_generation_size_in_bytes(self, limit: usize) -> Self
Sets the maximum size of the old generation in bytes. When the old generation approaches this limit, V8 will perform series of garbage collections and invoke the NearHeapLimitCallback.
Sourcepub fn max_young_generation_size_in_bytes(&self) -> usize
pub fn max_young_generation_size_in_bytes(&self) -> usize
Returns the maximum size of the young generation in bytes.
Sourcepub fn set_max_young_generation_size_in_bytes(self, limit: usize) -> Self
pub fn set_max_young_generation_size_in_bytes(self, limit: usize) -> Self
Sets the maximum size of the young generation in bytes. The young generation consists of two semi-spaces and a large object space. This affects frequency of Scavenge garbage collections.
Sourcepub fn code_range_size_in_bytes(&self) -> usize
pub fn code_range_size_in_bytes(&self) -> usize
Returns the code range size in bytes.
Sourcepub fn set_code_range_size_in_bytes(self, limit: usize) -> Self
pub fn set_code_range_size_in_bytes(self, limit: usize) -> Self
Sets the amount of virtual memory reserved for generated code in bytes. This is relevant for 64-bit architectures that rely on code range for calls in code.
Sourcepub fn stack_limit(&self) -> *mut u32
pub fn stack_limit(&self) -> *mut u32
Returns the stack limit (the address beyond which the VM’s stack may not grow), or null if not set.
Sourcepub unsafe fn set_stack_limit(self, value: *mut u32) -> Self
pub unsafe fn set_stack_limit(self, value: *mut u32) -> Self
Sets the address beyond which the VM’s stack may not grow.
§Safety
The caller must ensure that the pointer remains valid for the lifetime of the isolate, and points to a valid stack boundary.
Sourcepub fn initial_old_generation_size_in_bytes(&self) -> usize
pub fn initial_old_generation_size_in_bytes(&self) -> usize
Returns the initial size of the old generation in bytes.
Sourcepub fn set_initial_old_generation_size_in_bytes(
self,
initial_size: usize,
) -> Self
pub fn set_initial_old_generation_size_in_bytes( self, initial_size: usize, ) -> Self
Sets the initial size of the old generation in bytes. Setting the initial size avoids ineffective garbage collections at startup if the live set is large.
Sourcepub fn initial_young_generation_size_in_bytes(&self) -> usize
pub fn initial_young_generation_size_in_bytes(&self) -> usize
Returns the initial size of the young generation in bytes.
Sourcepub fn set_initial_young_generation_size_in_bytes(
self,
initial_size: usize,
) -> Self
pub fn set_initial_young_generation_size_in_bytes( self, initial_size: usize, ) -> Self
Sets the initial size of the young generation in bytes.