[ZoneBuilder] Use static allocator as unreleased data is freed anyways

This commit is contained in:
momo5502 2017-06-04 11:01:04 +02:00
parent dd12532273
commit 53af2af8b7
2 changed files with 2 additions and 9 deletions

View File

@ -2,8 +2,6 @@
namespace Components
{
Utils::Memory::Allocator ZoneBuilder::MemAllocator;
std::string ZoneBuilder::TraceZone;
std::vector<std::pair<Game::XAssetType, std::string>> ZoneBuilder::TraceAssets;
@ -727,7 +725,7 @@ namespace Components
int ZoneBuilder::StoreTexture(Game::GfxImageLoadDef **loadDef, Game::GfxImage *image)
{
size_t size = 16 + (*loadDef)->resourceSize;
void* data = ZoneBuilder::MemAllocator.allocate(size);
void* data = Utils::Memory::GetAllocator()->allocate(size);
std::memcpy(data, *loadDef, size);
image->loadDef = reinterpret_cast<Game::GfxImageLoadDef *>(data);
@ -739,7 +737,7 @@ namespace Components
{
if (header.image && header.image->loadDef)
{
ZoneBuilder::MemAllocator.free(header.image->loadDef);
Utils::Memory::GetAllocator()->free(header.image->loadDef);
}
}
@ -1522,10 +1520,6 @@ namespace Components
ZoneBuilder::~ZoneBuilder()
{
#if DEBUG
assert(ZoneBuilder::MemAllocator.empty());
#endif
ZoneBuilder::Terminate = true;
if(ZoneBuilder::CommandThread.joinable())
{

View File

@ -109,7 +109,6 @@ namespace Components
static Game::XAssetHeader GetEmptyAssetIfCommon(Game::XAssetType type, std::string name, Zone* builder);
private:
static Utils::Memory::Allocator MemAllocator;
static int StoreTexture(Game::GfxImageLoadDef **loadDef, Game::GfxImage *image);
static void ReleaseTexture(Game::XAssetHeader header);