1 #pragma once 2 3 #include <systypes/base.h> 4 5 #include <list> 6 #include <mutex> 7 8 #include "memory_utils.h" 9 #include "region.h" 10 11 12 13 /* A memory pool abstraction. */ 14 15 class Memory 16 { 17 protected: 18 std::mutex _lock; 19 20 unsigned int _limit; 21 offset_t _region_size; 22 bool _limited; 23 24 public: 25 explicit Memory(unsigned int limit, offset_t region_size=PAGE_SIZE); 26 27 explicit Memory(); 28 29 Region *allocate(offset_t size); 30 31 Region *region(offset_t size); 32 33 Region *region(); 34 35 void release(Region *region); 36 }; 37 38 // vim: tabstop=4 expandtab shiftwidth=4