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.
Configure limits before the first conversion, then optionally warm the workers:
import vl_convert as vlc
vlc.configure(
num_workers=2,
max_v8_heap_size_mb=512,
max_v8_execution_time_secs=10,
gc_after_conversion=True,
)
vlc.warm_up_workers()
for worker in vlc.get_worker_memory_usage():
print(worker["worker_index"], worker["used_heap_size"])
Example output (heap sizes vary between runs):
0 3900704
1 3900704
Memory values are bytes. get_worker_memory_usage() starts the workers if they are not running yet.