virtmem
virtual memory library for Arduino
|
This struct contains default parameters for virtual memory pages. More...
#include <config.h>
Static Public Attributes | |
static const uint8_t | smallPageCount |
The number of small pages. | |
static const uint8_t | smallPageSize |
The size of a small page. | |
static const uint8_t | mediumPageCount |
The number of medium pages. | |
static const uint8_t | mediumPageSize |
The size of a medium page. | |
static const uint8_t | bigPageCount |
The number of big pages. | |
static const uint8_t | bigPageSize |
The size of a big page. | |
This struct contains default parameters for virtual memory pages.
The fields in this struct define the amount- and size of the small, medium and big memory pages for an allocator. The former two memory pages are only used for locking data. In general it is best to make sure that they are big enough to contain any structs/classes stored in virtual memory. The big memory pages are also used for data locking, but more importantly, they are used as a cache for virtual memory access (see basics).
Since all memory pages reside in regular RAM, changing their size and amount greatly influences the RAM used by virtmem. Besides reducing the RAM usage by lowering the amount and/or size of memory pages, it is also interesting to increase these numbers if you have some spare RAM. In general, increasing the number of pages will enhance random access times, whereas increasing the size of memory pages will reduce costly swapping and improve sequential memory access.
The default size and amount of memory pages is platform dependent, and can be changed in config.h. Alternatively, page settings can be set by defining a customized structure and passing this structure as a template parameter to an allocator.
Example: