Bug 1253036

Summary: 'free -b' shows incorrect value when memory is 10GB or more
Product: Red Hat Enterprise Linux 6 Reporter: Raymond Lee <raylee88>
Component: procpsAssignee: Jaromír Cápík <jcapik>
Status: CLOSED DUPLICATE QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.7CC: albert, ovasik, raylee88
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-12 19:20:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Raymond Lee 2015-08-12 19:12:19 UTC
Description of problem:
The 'free -b' command is supposed to show the amount of memory in bytes.  It looks like the number is getting truncated (maybe due to formatting?) when the amount of memory is 10GB or more.  'free -t -b' also shows a truncated number for total memory.  I'm assuming that the same would be true for swap if swap is 10GB or more.  Compare the outputs below from my RHEL 6.7 server with 64GB physical memory and 4GB swap:

# free -t -g
             total       used       free     shared    buffers     cached
Mem:            62         51         11          0          0          0
-/+ buffers/cache:         50         12
Swap:            3          0          3
Total:          66         51         15


# free -t -m
             total       used       free     shared    buffers     cached
Mem:         64425      52322      12102          0         28        205
-/+ buffers/cache:      52088      12336
Swap:         3967          0       3967
Total:       68393      52322      16070


# free -t -k
             total       used       free     shared    buffers     cached
Mem:      65972116   53578248   12393868        244      28920     210720
-/+ buffers/cache:   53338608   12633508
Swap:      4063228          0    4063228
Total:    70035344   53578248   16457096


# free -t -b
             total       used       free     shared    buffers     cached
Mem:    6755544678 5486408089 1269136588     249856   29614080  215777280
-/+ buffers/cache: 5461868953 1293675724
Swap:   4160745472          0 4160745472
Total:  7171619225 5486408089 1685211136


To verify what the number in bytes should be:
# echo "`free -t -k |awk '{if ($1 == "Mem:") print $2}'` * 1024" | bc -l
67555446784




Version-Release number of selected component (if applicable):
# uname -r
2.6.32-573.1.1.el6.x86_64

# rpm -q procps
procps-3.2.8-33.el6.x86_64


How reproducible:
100%


Steps to Reproduce:
1. On a system with at least 10GB physical memory, run 'free -t -b'
2.
3.


Actual results:
(On a system with 64GB physical memory and 4GB swap)
# free -t -b
             total       used       free     shared    buffers     cached
Mem:    6755544678 5486408089 1269136588     249856   29614080  215777280
-/+ buffers/cache: 5461868953 1293675724
Swap:   4160745472          0 4160745472
Total:  7171619225 5486408089 1685211136


Expected results:
# free -t -b
             total       used       free     shared    buffers     cached
Mem:   67555446784 5486408089 1269136588     249856   29614080  215777280
-/+ buffers/cache: 5461868953 1293675724
Swap:   4160745472          0 4160745472
Total: 71716192256 5486408089 1685211136


Additional info:

Comment 2 Jaromír Cápík 2015-08-12 19:20:37 UTC
Hello Raymond.

This issue has been reported in scope of Bug 1246379 and I'm closing this as duplicate.

Thanks for the report and for your understanding.

Regards,
Jaromir.

*** This bug has been marked as a duplicate of bug 1246379 ***