Go to the documentation of this file.
44 #ifndef COMMONCPP_MISC_H_
45 #define COMMONCPP_MISC_H_
47 #ifndef COMMONCPP_CONFIG_H_
48 #include <commoncpp/config.h>
51 #define KEYDATA_INDEX_SIZE 97
52 #define KEYDATA_PAGER_SIZE 512
55 #define KEYDATA_PATH_SIZE 512
57 #define KEYDATA_PATH_SIZE PATH_MAX
60 #define KEYDATA_PATH_SIZE 256
68 __DELETE_COPY(MemPager);
71 inline MemPager(
size_t pagesize = 4096) :
ucommon::memalloc(pagesize) {}
73 inline void *alloc(
size_t size) {
77 char *alloc(
const char *str);
79 inline char *first(
const char *str) {
83 inline void *first(
size_t size) {
87 inline int getPages(
void)
const {
91 inline void purge(
void) {
130 inline void *first(
size_t size) {
152 entry *entries[KEYDATA_INDEX_SIZE];
154 __DELETE_COPY(
Assoc);
162 virtual void *getMemory(
size_t size) = 0;
165 void *getPointer(
const char *
id)
const;
166 void setPointer(
const char *
id,
void *data);
SharedMemPager(size_t pagesize=4096)
Create a mempager mutex pool.
This class is used to associate (object) pointers with named strings.
Common namespace for all ucommon objects.
void purge(void)
Purge the memory pool while locked.
The shared mempager uses a mutex to protect key access methods.
A memory protocol pager for private heap manager.
void * alloc(size_t size)
Get the last memory page after locking.