§tiro_vm_settings

The tiro_vm_settings structure can be provided to tiro_vm_new as a configuration parameter. More...

#include "tiro/vm.h"

§Public Attributes

Name
size_tpage_size
The size (in bytes) of heap pages allocated by the virtual machine for the storage of most objects.
size_tmax_heap_size
The maximum size (in bytes) that can be occupied by the virtual machine's heap.
void *userdata
Arbitrary user data that will be accessible by calling [tiro_vm_userdata()]().
void(*)(tiro_string_t message, void *userdata)print_stdout
This callback is invoked when the vm attempts to print to the standard output stream, for example when std.print(...) has been called.
boolenable_panic_stack_trace
Set this to true to enable capturing of the current call stack trace when an exception is created during a panic.

§Detailed Description

struct tiro_vm_settings;

The tiro_vm_settings structure can be provided to tiro_vm_new as a configuration parameter.

Use tiro_vm_settings_init to initialize this struct to default values.

§Public Attributes Documentation

§variable page_size

size_t page_size;

The size (in bytes) of heap pages allocated by the virtual machine for the storage of most objects.

Must be a power of two between 2^16 and 2^24 or zero to use the default value.

Smaller pages waste less memory if only small workloads are to be expected. Larger page sizes can be more performant because fewer chunks need to be allocated for the same number of objects.

Note that objects that do not fit into a single page reasonably well will be allocated "on the side" using a separate allocation.

§variable max_heap_size

size_t max_heap_size;

The maximum size (in bytes) that can be occupied by the virtual machine's heap.

The virtual machine will throw out of memory errors if this limit is reached.

The default value (0) will apply a sane default memory limit. Use SIZE_MAX for an unconstrained heap size.

§variable userdata

void * userdata;

Arbitrary user data that will be accessible by calling [tiro_vm_userdata()]().

This value is never interpreted in any way. This value is NULL by default.

§variable print_stdout

void(*)(tiro_string_t message, void *userdata) print_stdout;

This callback is invoked when the vm attempts to print to the standard output stream, for example when std.print(...) has been called.

Parameters:

  • message The string to print. Not guaranteed to be null terminated.
  • userdata The userdata pointer set in this settings instance.

When this is set to NULL (the default), the message will be printed to the process's standard output.

§variable enable_panic_stack_trace

bool enable_panic_stack_trace;

Set this to true to enable capturing of the current call stack trace when an exception is created during a panic.

Capturing stack traces has a significant performance impact because many call frames on the call stack have to be visited.

Defaults to false.


Updated on 2022-02-27 at 21:17:13 +0100