1 #ifndef VIRTMEM_SD_ALLOC_H
2 #define VIRTMEM_SD_ALLOC_H
31 template <
typename Properties=DefaultAllocProperties>
39 if (sdFile.open(
"ramfile.vm", O_CREAT | O_EXCL))
43 if (!sdFile.open(
"ramfile.vm", O_CREAT | O_RDWR))
45 Serial.println(
"opening ram file failed");
50 const uint32_t size = sdFile.fileSize();
63 sdFile.seekSet(offset);
64 sdFile.read(data, size);
71 sdFile.seekSet(offset);
72 sdFile.write(data, size);
100 #endif // VIRTMEM_SD_ALLOC_H
contains all code from virtmem
Definition: base_alloc.cpp:22
void writeZeros(VPtrNum start, VPtrSize n)
Writes zeros to raw virtual memory. Can be used to initialize the memory pool.
Definition: base_alloc.cpp:489
Base template class for virtual memory allocators.
Definition: alloc.h:28
Virtual memory allocator class that uses SD card as virtual pool.
Definition: sd_alloc.h:32
void setPoolSize(VPtrSize ps)
Sets the total size of the memory pool.
Definition: base_alloc.h:155
SDVAllocP(VPtrSize ps=VIRTMEM_DEFAULT_POOLSIZE)
Definition: sd_alloc.h:81
virtual memory class header
void removeTempFile(void)
Definition: sd_alloc.h:88
uint32_t VPtrSize
Numeric type used to store the size of a virtual memory block.
Definition: base_alloc.h:22
VPtrSize getPoolSize(void) const
Returns the size the memory pool.
Definition: base_alloc.h:187
SDVAllocP SDVAlloc
Shortcut to SDVAllocP with default template arguments.
Definition: sd_alloc.h:91
#define VIRTMEM_DEFAULT_POOLSIZE
The default poolsize for allocators supporting a variable sized pool.
Definition: config.h:55