18 #include "dtoolbase.h"
19 #include "numeric_types.h"
20 #include "atomicAdjust.h"
21 #include "mutexImpl.h"
49 virtual void *heap_alloc_single(
size_t size);
50 virtual void heap_free_single(
void *ptr);
52 virtual void *heap_alloc_array(
size_t size);
53 virtual void *heap_realloc_array(
void *ptr,
size_t size);
54 virtual void heap_free_array(
void *ptr);
56 INLINE
void inc_heap(
size_t size);
57 INLINE
void dec_heap(
size_t size);
59 bool heap_trim(
size_t pad);
61 INLINE
static size_t get_memory_alignment();
62 INLINE
static size_t get_header_reserved_bytes();
64 virtual void *mmap_alloc(
size_t size,
bool allow_exec);
65 virtual void mmap_free(
void *ptr,
size_t size);
66 INLINE
size_t get_page_size()
const;
67 INLINE
size_t round_up_to_page_size(
size_t size)
const;
69 virtual void mark_pointer(
void *ptr,
size_t orig_size,
ReferenceCount *ref_ptr);
73 virtual void alloc_fail(
size_t attempted_size);
76 INLINE
static size_t inflate_size(
size_t size);
77 INLINE
static void *alloc_to_ptr(
void *alloc,
size_t size);
78 INLINE
static void *ptr_to_alloc(
void *ptr,
size_t &size);
80 #ifdef DO_MEMORY_USAGE
82 TVOLATILE AtomicAdjust::Integer _total_heap_single_size;
83 TVOLATILE AtomicAdjust::Integer _total_heap_array_size;
84 TVOLATILE AtomicAdjust::Integer _requested_heap_size;
85 TVOLATILE AtomicAdjust::Integer _total_mmap_size;
89 size_t _max_heap_size;
91 virtual void overflow_heap_size();
92 #endif // DO_MEMORY_USAGE
97 typedef map<size_t, DeletedBufferChain *> DeletedChains;
98 DeletedChains _deleted_chains;
103 #include "memoryHook.I"
A base class for all things that want to be reference-counted.
This class provides a wrapper around the various possible malloc schemes Panda might employ...
A fake mutex implementation for single-threaded applications that don't need any synchronization cont...
This template class can be used to provide faster allocation/deallocation for many Panda objects...