Based partially on a patch by wbk to fix Gentoo bug #410093 [1]. From the
bug report:
After fixing the /proc/meminfo issue, another bug will emerge on systems
where total system RAM in bytes exceeds INT_MAX. The correct top three
processes will be identified, but their load bars will have the wrong
value. This is caused by a value overflow due to storing total system
memory in an "int" type variable. We will end up thinking ((Total RAM)
modulo (INT_MAX)) is our total system RAM, so our percentages will be
inflated when drawing the load bar. This fix will require a bit more care
to follow the flow of data and ensure this value isn't being cast to "int"
along the way. Function return types will need to be changed.
[1] https://bugs.gentoo.org/show_bug.cgi?id=410093