1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-15 14:27:06 +01:00

global memory debug through command line flag

This commit is contained in:
2017-12-07 14:40:58 +01:00
parent 0fbf445edd
commit f9aa39e1c4
6 changed files with 57 additions and 42 deletions

View File

@ -216,14 +216,21 @@ void Environment::createDerivedObject(const std::string name,
if (!object_[address].data)
{
MemoryStats memStats;
MemoryProfiler::stats = &memStats;
if (!MemoryProfiler::stats)
{
MemoryProfiler::stats = &memStats;
}
size_t initMem = MemoryProfiler::stats->currentlyAllocated;
object_[address].storage = storage;
object_[address].Ls = Ls;
object_[address].data.reset(new Holder<B>(new T(std::forward<Ts>(args)...)));
object_[address].size = memStats.maxAllocated;
object_[address].size = MemoryProfiler::stats->maxAllocated - initMem;
object_[address].type = &typeid(T);
MemoryProfiler::stats = nullptr;
if (MemoryProfiler::stats == &memStats)
{
MemoryProfiler::stats = nullptr;
}
}
else
{