Library

Memory

Heap Allocation, Custom allocators, Virtual Memory, Buffer, Segment

Usable
Dependencies

No library-level dependencies

SaneCppMemory.h is library tracking and limiting runtime / dynamic allocations through the use of custom allocators.

All libraries are designed to let you use your favorite externally provided string / vector classes BUT if you've been sold on using also the Containers library then here you will find scoped allocator / arena infrastructure used by them.

Note: See Tests/InteropSTL/*.cpp for an example of externally provided Container classes.

The "owned" String class is here and not in Strings library because it needs allocator support.

Note: If a library doesn't directly or indirectly depend on the Memory library, you can assume that it will not do any runtime / dynamic allocation.

Dependencies

  • Dependencies: (none)
  • All dependencies: (none)

Dependency Graph

Features

Classes

Class Description
SC::Buffer SC::Buffer
SC::Memory SC::Memory
SC::VirtualMemory SC::VirtualMemory
SC::Globals SC::Globals
SC::String SC::String
SC::SmallString SC::SmallString

Status

Usable The library is solid. The Buffer implementation has been evolved and fine tuned to be minimal but effective.

Description

Memory library helps tracking and limit runtime / dynamic allocations through the use of custom allocators. A classic dynamically expandable binary buffer SC::Buffer is provided and it's largely shared to form the more object model oriented SC::Vector class from Containers Library.

All allocations throughout all downstream dependant libraries are centrally tracked by the SC::Globals class, that also allows re-defining custom thread-local allocators.

Such allocators can be just fixed buffers, regular heap memory or reserved SC::VirtualMemory using only limited amounts of Physical memory.

Buffer

String

SmallString

Memory

VirtualMemory

Globals

Blog

These blogs have been written before the split from Foundation into the Memory library:

These blog posts have been written after the split from foundation:

Roadmap

Complete Features:

  • Things will be added as needed

💡 Unplanned Features:

  • SharedPtr
  • UniquePtr

Note: In Principles there is a rule that discourages allocations of large number of tiny objects and also creating systems with unclear or shared memory ownership. For this reason this library is missing Smart Pointers.

Statistics

Type Lines Of Code Comments Sum
Headers 524 415 939
Sources 1026 211 1237
Sum 1550 626 2176