Hello,
I was trying to put an allocator in a struct, when I got some memory issues. Looking around, it seems that it boils down to the allocator function. I am still confused as to what &.{} does. I know we are taking a reference of a VTable, but where does the memory that vtable points to live? I am assuming that it doesn't live in the allocator function, so the function that calls allocator?
pub fn allocator(self: *FixedBufferAllocator) Allocator {
return .{
.ptr = self,
.vtable = &.{
.alloc = alloc,
.resize = resize,
.free = free,
},
};
}