SimpleAllocator
from panda3d.core import SimpleAllocator
- class SimpleAllocator
Bases:
DTOOL_SUPER_BASE
An implementation of a very simple block allocator. This class can allocate ranges of nonnegative integers within a specified upper limit; it uses a simple first-fit algorithm to find the next available space.
Inheritance diagram
- __init__(*args, **kwargs)
- alloc()
C++ Interface: alloc(const SimpleAllocator self, int size, int alignment)
- /**
Allocates a new block. Returns NULL if a block of the requested size
cannot be allocated.
To free the allocated block, call block->free(), or simply delete the block
pointer.
*/
- getContiguous()
C++ Interface: get_contiguous(SimpleAllocator self)
- /**
Returns an upper-bound estimate of the size of the largest contiguous block
that may be allocated. It is guaranteed that an attempt to allocate a
block larger than this will fail, though it is not guaranteed that an
attempt to allocate a block this size or smaller will succeed.
*/
- getFirstBlock()
C++ Interface: get_first_block(SimpleAllocator self)
- /**
Returns a pointer to the first allocated block, or NULL if there are no
allocated blocks.
*/
- getMaxSize()
C++ Interface: get_max_size(SimpleAllocator self)
- /**
Returns the available space for allocated objects.
*/
- getTotalSize()
C++ Interface: get_total_size(SimpleAllocator self)
- /**
Returns the total size of allocated objects.
*/
- get_contiguous()
C++ Interface: get_contiguous(SimpleAllocator self)
- /**
Returns an upper-bound estimate of the size of the largest contiguous block
that may be allocated. It is guaranteed that an attempt to allocate a
block larger than this will fail, though it is not guaranteed that an
attempt to allocate a block this size or smaller will succeed.
*/
- get_first_block()
C++ Interface: get_first_block(SimpleAllocator self)
- /**
Returns a pointer to the first allocated block, or NULL if there are no
allocated blocks.
*/
- get_max_size()
C++ Interface: get_max_size(SimpleAllocator self)
- /**
Returns the available space for allocated objects.
*/
- get_total_size()
C++ Interface: get_total_size(SimpleAllocator self)
- /**
Returns the total size of allocated objects.
*/
- isEmpty()
C++ Interface: is_empty(SimpleAllocator self)
- /**
Returns true if there are no blocks allocated on this page, or false if
there is at least one.
*/
- is_empty()
C++ Interface: is_empty(SimpleAllocator self)
- /**
Returns true if there are no blocks allocated on this page, or false if
there is at least one.
*/
- setMaxSize()
C++ Interface: set_max_size(const SimpleAllocator self, int max_size)
- /**
Changes the available space for allocated objects. This will not affect
any already-allocated objects, but will have an effect on future calls to
alloc().
*/