Hey everyone, I came across a small problem that I just can't seem to solve.
I want to preallocate 512 entries in my hashmap and for each of these entries I want to have a set ArrayList with 32 entries.
std.AutoArrayHashMapUnmanaged(Idx, std.ArrayList(usize))
I want to allocate once and then not care about allocation anymore.
I do want to add and remove as many times as I like but keep the capacity.
Is there a way to preallocate the full amount and not care anymore?
Do I need to use an Arena Allocator and allocate the whole memory in advance?
#Preallocate std.AutoArrayHashMapUnmanaged(Idx, std.ArrayList(usize))
1 messages · Page 1 of 1 (latest)
why not just have one big arraylist with 512 * 32 entries and then have the hash map refer to slices within that big arraylist?