module scheme import arena fn test_bounded_rest_spines_allocate_only_their_pair_cells() { mut instance := new_bounded(Options{}, arena.ChunkLimits{ max_live_bytes: 8 * 1024 * 1024 })! defer { instance.close() or { panic(err) } } instance.run(fn (mut vm VM) !Value { for count in [0, 1, 3, 4, 65] { items := []Value{len: count, init: integer(42)} // Start on a whole-pair boundary so unrelated cursor padding is // excluded from the allocation contract being measured. unsafe { arena.current_allocator().calloc(int(sizeof(Pair))) } before, _ := v_arena_stats(v_arena_current()) value := vm.owner.bounded_files.argument_list(items)! after, _ := v_arena_stats(v_arena_current()) assert after - before == count * int(sizeof(Pair)) assert value.list_length()! == count if count > 0 { assert value.pair_pointer().car.as_integer()! == 42 } } return unspecified() })! }