Skip to content

Pablyco/Allocators

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Allocators

This project contains simple memory allocator implementations written in C++ for learning purposes.

The goal is to understand how custom memory allocation strategies work internally, how memory can be managed manually, and what trade-offs different allocator types have.

Implemented Allocators

Linear Allocator / Bump Allocator

A Linear Allocator, also known as a Bump Allocator, manages a fixed block of memory and allocates memory sequentially from it.

It keeps an internal offset that starts at the beginning of the buffer. When memory is requested, the allocator returns the current position in the buffer and then advances the offset by the requested size.

This makes allocation very fast because it only requires a simple check and an offset increment.

However, individual allocations cannot be freed. Instead, all allocated memory is released at once by resetting the allocator, which moves the offset back to the beginning of the buffer.

This type of allocator is useful when many temporary allocations are needed and can all be discarded together.

Work in Progress

The following allocator types are planned or currently in progress:

  • Pool Allocator
  • Stack Allocator

Notes

This project is intended for educational purposes and keeps the implementations simple.

Some production-level features may be missing, such as:

  • alignment handling
  • copy/move safety
  • detailed error handling
  • thread safety

About

Simple C++ implementations of custom memory allocators for learning purposes, starting with a Linear/Bump Allocator and expanding with Pool and Stack allocators

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors