≈ the.bay.news

How to manage memory with light wrappers?

Ziggit
How to manage memory with light wrappers?
I am making a library with these structs: Vault is just a light wrapper around StringHashMapUnmanaged(Item). Item is light wrapper around StringHashMapUnmanaged(Value). For both of these structs the user interacts with the hashmap directly, they own the memory too, so when they free the vault it would look like this: var vault1: Vault = .init(); defer { var items_it = vault1.items.iterator(); while (items_it.next()) |item_entry| { std.testing.allocator.free(item_entry.key_ptr...

0 comments

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

No comments yet.