Nebula
Loading...
Searching...
No Matches
posixmemory.h File Reference

Detailed Description

Memory subsystem features for the Posix platform.

(C) 2008 Radon Labs GmbH (C) 2013-2018 Individual contributors, see AUTHORS file

#include "core/config.h"
#include "core/debug.h"
#include "threading/interlocked.h"
#include "memory/posix/posixmemoryconfig.h"
#include <malloc.h>
#include <string.h>
#include <sys/mman.h>

Go to the source code of this file.

Classes

struct  Memory::TotalMemoryStatus
 Get the system's total current memory, this does not only include Nebula's memory allocations but the memory usage of the entire system. More...
 

Namespaces

namespace  Memory
 Allocates memory using the TLSF method (http://www.gii.upv.es/tlsf/files/ecrts04_tlsf.pdf), with extended handling of padding to better suit GPUs.
 

Macros

#define MEMORY_POSIXMEMORY_H
 
#define StackAlloc(size)
 
#define StackFree(ptr)
 

Functions

void * Memory::Alloc (HeapType heapType, size_t size, size_t alignment)
 Allocate a block of memory from one of the global heaps.
 
void * Memory::Realloc (HeapType heapType, void *ptr, size_t size)
 Re-Allocate a block of memory from one of the global heaps.
 
void Memory::Free (HeapType heapType, void *ptr)
 Free a block of memory.
 
__forceinline void * Memory::AllocVirtual (size_t size)
 allocate a range of virtual memory space
 
__forceinline void Memory::DecommitVirtual (void *ptr, size_t size)
 decommit virtual memory
 
__forceinline void Memory::CommitVirtual (void *ptr, size_t size)
 commit virtual memory
 
__forceinline void Memory::FreeVirtual (void *ptr, size_t size)
 free virtual memory
 
void Memory::Copy (const void *from, void *to, size_t numBytes)
 Copy a chunk of memory (note the argument order is different from memcpy()!!!)
 
__forceinline void Memory::Move (const void *from, void *to, size_t numBytes)
 Move a chunk of memory, can handle overlapping regions.
 
template<typename T >
__forceinline void Memory::MoveElements (const T *from, T *to, size_t numElements)
 Move a chunk of memory, can handle overlapping regions.
 
template<typename T >
__forceinline void Memory::CopyElements (const T *from, T *to, size_t numElements)
 Copy a chunk of memory (note the argument order is different from memcpy()!!!)
 
__forceinline void Memory::CopyToGraphicsMemory (const void *from, void *to, size_t numBytes)
 Copy data from a system memory buffer to graphics resource memory.
 
void Memory::Clear (void *ptr, size_t numBytes)
 Overwrite a chunk of memory with 0's.
 
void Memory::Fill (void *ptr, size_t numBytes, unsigned char value)
 Fill memory with a specific byte.
 
char * Memory::DuplicateCString (const char *from)
 Duplicate a 0-terminated string, this method should no longer be used!
 
bool Memory::IsOverlapping (const unsigned char *srcPtr, size_t srcSize, const unsigned char *dstPtr, size_t dstSize)
 Test if 2 areas of memory areas are overlapping.
 
TotalMemoryStatus Memory::GetTotalMemoryStatus ()
 Get the system's total memory status.
 

Macro Definition Documentation

◆ MEMORY_POSIXMEMORY_H

#define MEMORY_POSIXMEMORY_H

◆ StackAlloc

#define StackAlloc ( size)
Value:
alloca(size);

◆ StackFree

#define StackFree ( ptr)