dvander@54: /* dvander@54: * Copyright (C) 2012 David Anderson dvander@54: * dvander@54: * This file is part of JITCraft. dvander@54: * dvander@54: * JITCraft is free software: you can redistribute it and/or modify it under dvander@54: * the terms of the GNU General Public License as published by the Free dvander@54: * Software Foundation, either version 3 of the License, or (at your option) dvander@54: * any later version. dvander@54: * dvander@54: * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY dvander@54: * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS dvander@54: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. dvander@54: * dvander@54: * You should have received a copy of the GNU General Public License along with dvander@54: * JITCraft. If not, see http://www.gnu.org/licenses/. dvander@54: */ dvander@54: #ifndef _include_jc_allocators_h_ dvander@54: #define _include_jc_allocators_h_ dvander@54: dvander@54: #include dvander@54: dvander@59: namespace ke { dvander@54: dvander@54: class ZoneAllocatorPolicy dvander@54: { dvander@54: protected: dvander@54: void reportOutOfMemory(); dvander@54: void reportAllocationOverflow(); dvander@54: dvander@54: public: dvander@54: void free(void *memory) { dvander@54: ::free(memory); dvander@54: } dvander@54: void *malloc(size_t bytes) { dvander@54: void *ptr = ::malloc(bytes); dvander@54: if (!ptr) dvander@54: reportOutOfMemory(); dvander@54: return ptr; dvander@54: } dvander@54: }; dvander@54: dvander@54: } dvander@54: dvander@54: #endif // _include_jc_allocators_h_