1 #include "PagedAllocator.h"
7 PagedAllocator::PagedAllocator(unsigned int pageSize)
13 PagedAllocator::~PagedAllocator() {
14 for (deque<char *>::const_iterator i(pages.begin()), end(pages.end()); i != end; ++i) {
20 char *PagedAllocator::Alloc(unsigned int size) {
21 if (size > pageSize) {
22 char *page(new char[size]);
23 pages.push_front(page);
26 unsigned int free(Free());
35 unsigned int PagedAllocator::Free() const {
36 return pageSize - (head - CurrentPage());
39 void PagedAllocator::NewPage() {
40 char *page(new char[pageSize]);
41 pages.push_back(page);
45 char *PagedAllocator::CurrentPage() {
49 const char *PagedAllocator::CurrentPage() const {