Panda3D
Classes | Static Public Member Functions
NeverFreeMemory Class Reference

This class is used to allocate bytes of memory from a pool that is never intended to be freed. More...

#include "neverFreeMemory.h"

List of all members.

Classes

class  Page

Static Public Member Functions

static void * alloc (size_t size)
 Returns a pointer to a newly-allocated block of memory of the indicated size.
static size_t get_total_alloc ()
 Returns the total number of bytes consumed by all the pages allocated internally by this object.
static size_t get_total_unused ()
 Returns the difference between get_total_alloc() and get_total_used().
static size_t get_total_used ()
 Returns the total number of bytes requested by the application in calls to NeverFreeMemory::alloc().

Detailed Description

This class is used to allocate bytes of memory from a pool that is never intended to be freed.

It is particularly useful to support DeletedChain, which allocates memory in just such a fashion.

When it is known that memory will not be freed, it is preferable to use this instead of the standard malloc() (or global_operator_new()) call, since this will help reduce fragmentation problems in the dynamic heap. Also, memory allocated from here will exhibit less wasted space.

Definition at line 37 of file neverFreeMemory.h.


Member Function Documentation

void * NeverFreeMemory::alloc ( size_t  size) [inline, static]

Returns a pointer to a newly-allocated block of memory of the indicated size.

Definition at line 23 of file neverFreeMemory.I.

Referenced by DeletedBufferChain::allocate().

size_t NeverFreeMemory::get_total_alloc ( ) [inline, static]

Returns the total number of bytes consumed by all the pages allocated internally by this object.

Definition at line 34 of file neverFreeMemory.I.

size_t NeverFreeMemory::get_total_unused ( ) [inline, static]

Returns the difference between get_total_alloc() and get_total_used().

This represents bytes in allocated pages that have not (yet) been used by the application.

Definition at line 58 of file neverFreeMemory.I.

size_t NeverFreeMemory::get_total_used ( ) [inline, static]

Returns the total number of bytes requested by the application in calls to NeverFreeMemory::alloc().

Definition at line 45 of file neverFreeMemory.I.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations