Memory and Execution Limits#
VlConvert runs Vega and Vega-Lite in V8 JavaScript workers. Two converter settings bound that work:
max_v8_heap_size_mbcaps the JavaScript heap of each worker. The minimum accepted value is 64 MB.max_v8_execution_time_secsstops JavaScript execution after the given number of seconds.
Both are unlimited by default. Set them when specifications are untrusted or when a service needs predictable failure boundaries. A conversion that hits either limit fails, and later conversions continue normally.
These settings do not cap the whole process. Decoded images, fonts, raster buffers, PDF generation, and other native allocations live outside the JavaScript heap. Use operating-system or container limits as an outer boundary on these if needed.
Size the Worker Pool#
Each persistent worker has its own JavaScript runtime and heap. More workers allow more concurrent conversions but raise baseline and peak memory usage.
gc_after_conversion asks the JavaScript engine to collect garbage after every conversion. It can reduce the heap retained between requests at the cost of throughput.
Set limits in VlcConfig and read heap statistics with get_worker_memory_usage():
use std::num::NonZeroU64;
use vl_convert_rs::{VlcConfig, VlConverter};
let converter = VlConverter::with_config(VlcConfig {
num_workers: NonZeroU64::new(2).unwrap(),
max_v8_heap_size_mb: NonZeroU64::new(512),
max_v8_execution_time_secs: NonZeroU64::new(10),
..Default::default()
})?;
converter.warm_up()?;
let usage = converter.get_worker_memory_usage().await?;