ZigGBA icon indicating copy to clipboard operation
ZigGBA copied to clipboard

Add `Allocator` API

Open vortexofdoom opened this issue 1 year ago • 0 comments

An allocator that can keep track of the available memory in a given region would be very useful, particularly for relatively small and potentially sparsely populated regions such as oam. This would ideally include:

  • General purpose allocator for wram
  • Generic allocator specialized to individual regions optimized for particular types (object attributes, tile data, etc.)
  • An overarching allocator wrapping all of these for all library types, potentially using the std.Allocator interface.

If a general-purpose allocator is too bloated or slow, we should at least expose an API by which users can insert their own allocation strategies optimized for their use case.

Planned features (open to discussion):

  • [ ] Create and manage fixed-size pools of memory with different replacement/update strategies. It's rare to want to manage all object types the same way: sometimes you want an instantiation to replace an existing item, and sometimes you want it to just fail silently. LRU, LFU, and other Eviction strategies would be good to include at the library level.

vortexofdoom avatar Nov 20 '24 21:11 vortexofdoom