Skip to content

Commit

Permalink
Refs #4472 fix MemoryStats returning negative available memory(!)
Browse files Browse the repository at this point in the history
which overflowed the unsigned int giving billions of GB available
  • Loading branch information
Janik Zikovsky committed Mar 29, 2012
1 parent d312a06 commit 8ff2222
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Kernel/src/Memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ void MemoryStats::process_mem_system(size_t & sys_avail, size_t & sys_total)
sys_avail = totPages / 1024 * pageSize;
}
// Can get the info on the memory that we've already obtained but aren't using right now
const int unusedReserved = mallinfo().fordblks/1024;
int unusedReserved = mallinfo().fordblks/1024;
// unusedReserved can sometimes be negative, which wen added to a low sys_avail will overflow the unsigned int.
if (unusedReserved < 0) unusedReserved = 0;
// g_log.debug() << "Linux - Adding reserved but unused memory of " << unusedReserved << " KB\n";
Expand Down

0 comments on commit 8ff2222

Please sign in to comment.