1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Fixed memory leaks

This commit is contained in:
Brian Fiete 2020-05-14 14:56:25 -07:00
parent 29fbafb91f
commit 2ac6b339b2
4 changed files with 51 additions and 15 deletions

View file

@ -398,6 +398,18 @@ public:
}
~Dictionary()
{
DeleteData();
}
void AllocData(intptr size, Entry*& outEntries, int_cosize*& outBuckets)
{
uint8* data = new uint8[size * (sizeof(Entry) + sizeof(int_cosize))];
outEntries = (Entry*)data;
outBuckets = (int_cosize*)(data + size * sizeof(Entry));
}
void DeleteData()
{
if (!std::is_pod<TKey>::value)
{
@ -417,18 +429,6 @@ public:
}
}
DeleteData();
}
void AllocData(intptr size, Entry*& outEntries, int_cosize*& outBuckets)
{
uint8* data = new uint8[size * (sizeof(Entry) + sizeof(int_cosize))];
outEntries = (Entry*)data;
outBuckets = (int_cosize*)(data + size * sizeof(Entry));
}
void DeleteData()
{
delete mEntries;
}