Sane C++ Libraries
C++ Platform Abstraction Libraries
Loading...
Searching...
No Matches
SC::Memory Struct Reference

Centralized functions to allocate, reallocate and deallocate memory. More...

#include <Memory.h>

Static Public Member Functions

static void * allocate (size_t numBytes, size_t alignment)
 Allocates numBytes bytes of memory.
 
static void * reallocate (void *memory, size_t numBytes)
 Change size of already allocated memory block.
 
static void release (void *memory)
 Free memory allocated by Memory::allocate and / or reallocated by Memory::reallocate.
 
static void move (void *dst, const void *src, size_t numBytes)
 Move numBytes bytes of memory from src to dst. The memory areas may overlap.
 
static void set (void *dst, int c, size_t numBytes)
 Set numBytes bytes of memory at dst to the value c.
 
static void copy (void *dst, const void *src, size_t numBytes)
 Copy numBytes bytes of memory from src to dst. The memory areas must not overlap.
 

Detailed Description

Centralized functions to allocate, reallocate and deallocate memory.

Member Function Documentation

◆ allocate()

static void * SC::Memory::allocate ( size_t numBytes,
size_t alignment )
static

Allocates numBytes bytes of memory.

Parameters
numBytesNumber of bytes to allocate
alignmentAlignment of the returned memory
Returns
Raw pointer to allocated memory, to be freed with Memory::release

◆ copy()

static void SC::Memory::copy ( void * dst,
const void * src,
size_t numBytes )
static

Copy numBytes bytes of memory from src to dst. The memory areas must not overlap.

◆ move()

static void SC::Memory::move ( void * dst,
const void * src,
size_t numBytes )
static

Move numBytes bytes of memory from src to dst. The memory areas may overlap.

◆ reallocate()

static void * SC::Memory::reallocate ( void * memory,
size_t numBytes )
static

Change size of already allocated memory block.

Existing contents of input buffer will be copied over.

Parameters
memorypointer to memory previously allocated by Memory::allocate or Memory::Reallocate
numBytesnew size of the reallocated block
Returns
A new pointer of memory with size numBytes, to be freed with Memory::release

◆ release()

static void SC::Memory::release ( void * memory)
static

Free memory allocated by Memory::allocate and / or reallocated by Memory::reallocate.

Parameters
memoryMemory to release / deallocate

◆ set()

static void SC::Memory::set ( void * dst,
int c,
size_t numBytes )
static

Set numBytes bytes of memory at dst to the value c.


The documentation for this struct was generated from the following file: