You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
488 B
26 lines
488 B
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <map>
|
|
|
|
struct mmap_buffer_t
|
|
{
|
|
void *addr = NULL;
|
|
uint64_t size = 0;
|
|
uint64_t freed = 0;
|
|
uint64_t pos = 0;
|
|
};
|
|
|
|
class mmap_manager_t
|
|
{
|
|
protected:
|
|
uint64_t mmap_size = 32*1024*1024;
|
|
std::map<void*, mmap_buffer_t> past_buffers;
|
|
mmap_buffer_t active_buffer;
|
|
|
|
public:
|
|
mmap_manager_t(uint64_t mmap_size = 32*1024*1024);
|
|
~mmap_manager_t();
|
|
void *alloc(uint64_t size);
|
|
void free(void *addr, uint64_t size);
|
|
};
|
|
|