Did some malloc replacing and things are going well so far. Start by reserving 5 GiB of virtual memory and then I create a subarena of 1MB for the commands.
VmemArena main_arena;
if (!init_vmem_arena(&main_arena, GB(5)))
return 1;
Arena command_arena;
if (!init_subarena_from_vmem_arena(&command_arena, &main_arena, MB(1)))
return 1;
....
while (engine_state.running)
{
arena_reset(&command_arena);
Comment too long. Click here to view the full text.