mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 04: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
|
||||
{
|
||||
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])
|
||||
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] -= ev.size;
|
||||
{
|
||||
std::cerr << "Error in memory tracer: have allocated memory < 0 in tracer " << names[ev.id] << std::endl;
|
||||
mem_allocated_id[ev.id] = 0;
|
||||
}
|
||||
else
|
||||
mem_allocated_id[ev.id] -= ev.size;
|
||||
}
|
||||
}
|
||||
|
||||
@ -985,7 +992,12 @@ namespace ngcore
|
||||
if(ev.is_alloc)
|
||||
mem_allocated_id[ev.id] += ev.size;
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user