mirror of
https://github.com/copyrighttxt/watrbx-game-engine.git
synced 2026-09-04 20:57:49 +00:00
37 lines
824 B
C++
37 lines
824 B
C++
#pragma once
|
|
|
|
#include "Util/Memory.h"
|
|
#include "boost/pool/object_pool.hpp"
|
|
#include "boost/iostreams/filter/gzip.hpp"
|
|
|
|
|
|
namespace RBX
|
|
{
|
|
class LuaAllocator
|
|
{
|
|
private:
|
|
size_t heapSize;
|
|
size_t heapCount;
|
|
size_t maxHeapSize;
|
|
size_t maxHeapCount;
|
|
|
|
// memory pools
|
|
std::vector<boost::pool<>*> memPools;
|
|
|
|
public:
|
|
LuaAllocator(bool usePool = false);
|
|
~LuaAllocator();
|
|
|
|
static size_t heapLimit; // maximum heap size allowed. 0 == no limit
|
|
|
|
void clearHeapMax();
|
|
void getHeapStats(size_t& heapSize, size_t& heapCount, size_t& maxHeapSize, size_t& maxHeapCount) const;
|
|
void getHeapStats(size_t& heapSize, size_t& heapCount) const;
|
|
|
|
bool hasSpace(const long diff);
|
|
virtual void* alloc(void *ptr, size_t osize, size_t nsize);
|
|
static void * alloc(void *ud, void *ptr, size_t osize, size_t nsize);
|
|
|
|
};
|
|
}
|