NEWS 25.7 KB
top: protect against the anomalous 'Mem' graph display · a2ceb95e
Until this patch, top falsely assumed that there would always be some (small) amount of physical memory after subtracting 'used' and 'available' from the total. But as the issue referenced below attests, a sum of 'used' and 'available' might exceed that total memory amount. I'm not sure if this is a problem with our calculation of the 'used' amount, a flaw in the kernel 'available' algorithms or some other reason I cannot even imagine. Anyway, this patch protects against such a contingency through the following single line addition of new code . if (pct_used + pct_misc > 100.0 || pct_misc < 0) ... The check for less than zero is not actually necessary as long as the source numbers remain unsigned. However should they ever become signed, we'll have protection. [ Most of the changes in this commit simply separate ] [ a variable's definition from its associated logic. ] Reference(s): #64 Signed-off-by: Jim Warner <firstname.lastname@example.org>jim warner committed
To find the state of this project's repository at the time of any of these versions, check out the tags.