o
odinpkg.dev
packages / library / odin-OffsetAllocator

odin-OffsetAllocator

49b0732library

No description provided.

MIT · updated 5 months ago

Odin port of OffsetAllocator

Usage

import offset_allocator "path/to/odin-OffsetAllocator"

oa, oa_alloc_err := offset_allocator.init(size = 1024 * 1024, max_allocations = 1024, allocator = context.allocator)
defer offset_allocator.deinit(&oa)
ensure(oa_alloc_err == nil)

a, alloc_err := alloc(&oa, 1337)
// expect(t, alloc_err == nil, "allocation should succeed")
// expect(t, is_valid(a), "allocation should be valid")
// expect_value(t, a.offset, 0)
free(&oa, a)