mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-11 21:50:34 +05:00
if more memory is deallocated than allocated set memtracer to 0 not
negative values
This commit is contained in:
parent
a69cdc9000
commit
922ad16213
@ -967,12 +967,19 @@ namespace ngcore
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(ev.size > mem_allocated)
|
if(ev.size > mem_allocated)
|
||||||
std::cerr << "Error in memory tracer: have total allocated memory < 0" << std::endl;
|
{
|
||||||
|
std::cerr << "Error in memory tracer: have total allocated memory < 0" << std::endl;
|
||||||
|
mem_allocated = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
mem_allocated -= ev.size;
|
||||||
if(ev.size > mem_allocated_id[ev.id])
|
if(ev.size > mem_allocated_id[ev.id])
|
||||||
std::cerr << "Error in memory tracer: have allocated memory < 0 in tracer " << names[ev.id] << std::endl;
|
{
|
||||||
|
std::cerr << "Error in memory tracer: have allocated memory < 0 in tracer " << names[ev.id] << std::endl;
|
||||||
mem_allocated -= ev.size;
|
mem_allocated_id[ev.id] = 0;
|
||||||
mem_allocated_id[ev.id] -= ev.size;
|
}
|
||||||
|
else
|
||||||
|
mem_allocated_id[ev.id] -= ev.size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -985,7 +992,12 @@ namespace ngcore
|
|||||||
if(ev.is_alloc)
|
if(ev.is_alloc)
|
||||||
mem_allocated_id[ev.id] += ev.size;
|
mem_allocated_id[ev.id] += ev.size;
|
||||||
else
|
else
|
||||||
mem_allocated_id[ev.id] -= ev.size;
|
{
|
||||||
|
if(ev.size > mem_allocated_id[ev.id])
|
||||||
|
mem_allocated_id[ev.id] = 0;
|
||||||
|
else
|
||||||
|
mem_allocated_id[ev.id] -= ev.size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TreeNode root;
|
TreeNode root;
|
||||||
|
Loading…
Reference in New Issue
Block a user