The mmapcache also manages the upper limit about how much memory can be mmaped.
Definition in file mmapcache.h.
#include "lib/error.h"
#include "lib/mrucache.h"
#include "lib/mutex.h"
#include "backend/mmap.h"
#include <nobug.h>

Go to the source code of this file.
Classes | |
| struct | lumiera_mmapcache_struct |
Typedefs | |
|
typedef struct lumiera_mmapcache_struct | lumiera_mmapcache |
| typedef lumiera_mmapcache * | LumieraMMapcache |
Functions | |
| int | lumiera_mmapcache_age (LumieraMMapcache self) |
| Destroy and free the nelem oldest elements. | |
| void | lumiera_mmapcache_announce (LumieraMMapcache self, LumieraMMap map) |
| Announce a new mmap object to the cache quotas. | |
| void | lumiera_mmapcache_checkin (LumieraMMapcache self, LumieraMMap handle) |
| Put a mmap into the cache Mmaps which are checked in are subject of cache aging and might get destroyed and reused. | |
| LumieraMMap | lumiera_mmapcache_checkout (LumieraMMapcache self, LumieraMMap handle) |
| Remove a mmap from cache aging Mmaps which are subject of cache aging must be checked out before they can be used. | |
| void | lumiera_mmapcache_delete (void) |
| Delete the mmap cache. | |
| void | lumiera_mmapcache_forget (LumieraMMapcache self, LumieraMMap map) |
| Remove a mmap object from the cache quotas. | |
| LumieraMMap | lumiera_mmapcache_mmap_acquire (LumieraMMapcache self) |
| Get a fresh mmap object. | |
| void | lumiera_mmapcache_new (size_t limit) |
| Initializes the mmapcache. | |
Variables | |
| LumieraMMapcache | lumiera_mcache |
| void lumiera_mmapcache_new | ( | size_t | limit | ) |
Initializes the mmapcache.
| limit | the mmapcache will drop elements when the sum of all mmapings gives over limit |
| void lumiera_mmapcache_delete | ( | void | ) |
Delete the mmap cache.
No mmaps in the cache must be locked, this would be a fatal error. The handles are closed automatically.
| LumieraMMap lumiera_mmapcache_mmap_acquire | ( | LumieraMMapcache | self | ) |
Get a fresh mmap object.
when mmaped_limit is reached, the oldest mmap object gets dropped else a new allocated object is returned
| self | pointer to the cache |
| void lumiera_mmapcache_announce | ( | LumieraMMapcache | self, | |
| LumieraMMap | map | |||
| ) |
Announce a new mmap object to the cache quotas.
Update the statistics kept in the cache, the map object is still considered to be checked out
| self | pointer to the cache | |
| map | object to be announced |
| void lumiera_mmapcache_forget | ( | LumieraMMapcache | self, | |
| LumieraMMap | map | |||
| ) |
Remove a mmap object from the cache quotas.
Update the statistics kept in the cache, called by mmap's destructor only
| self | pointer to the cache | |
| map | object to be removed |
| int lumiera_mmapcache_age | ( | LumieraMMapcache | self | ) |
Destroy and free the nelem oldest elements.
Used to free up resources and memory.
| self | cache where to free elements. |
| LumieraMMap lumiera_mmapcache_checkout | ( | LumieraMMapcache | self, | |
| LumieraMMap | handle | |||
| ) |
Remove a mmap from cache aging Mmaps which are subject of cache aging must be checked out before they can be used.
| self | the mmapcache | |
| handle | the mmap to be checked out |
| void lumiera_mmapcache_checkin | ( | LumieraMMapcache | self, | |
| LumieraMMap | handle | |||
| ) |
Put a mmap into the cache Mmaps which are checked in are subject of cache aging and might get destroyed and reused.
| self | the mmapcache | |
| handle | the mmap to be checked in |
1.5.6