≈ the.bay.news

How to free allocated slice partially?

Ziggit
How to free allocated slice partially?
test "example" { const buf = try std.heap.page_allocator.alloc(u8, 10); std.heap.page_allocator.free(buf[5..]); } This test panics with incorrect alignment error. I also tried rawFree with different alignments, but was getting the same error anyway. Is it even possible to do this? In the real code I allocate a huge slice, write some data there, store the filled part and cache the unused one for future usage if it exists. Partial deallocation raises the panic

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.