This project is an attempt to replicate Tiny Alloc in the EVM
For the initial stage, the public interface of the memory pool class will include the following:
Returns a pointer (as a u256) to address in heap space or 0 if allocation failed
Attempts to adjust the size of the block at the given allocated address to new size or if not possible, attempt to allocate a new block and copies contents of current block (if successful, automatically frees old address). Returns new address if successful or else 0.
Releases given address or array view back into the pool. Returns true if successful.
Frees all allocated blocks, essentially resets the pool.
Returns pool statistics
Further optimizations that are being performed under the hood in order to preserve memory space
The allocator supports coalescing of free memory blocks to minimize fragmentation of the managed address space.
In order to avoid unnecessary growing of the heap top, the allocator can split existing free blocks if the user requests allocating a smaller size than that of a suitable free block available.
Pointer to first free block header
Pointer to first used block header
Address of next new block header
End address of managed region
Minimum block size allowed for splitting
The size of the block (inluding header & padding)
Pointer to next block of the same type (free, used)
Data to be held inside the block (depending on how this project pans out, this can be a memory buffer)
this project is still a WIP, the initial stage is not complete