Bug 175375 - "Memory" wrong with > 4GB processes
"Memory" wrong with > 4GB processes
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: gnome-system-monitor (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Søren Sandmann Pedersen
: Desktop
Depends On:
Blocks: 187538
  Show dependency treegraph
Reported: 2005-12-09 11:38 EST by Bastien Nocera
Modified: 2014-06-18 05:08 EDT (History)
3 users (show)

See Also:
Fixed In Version: RHBA-2006-0326
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-05-10 18:19:00 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
test.c (394 bytes, text/plain)
2005-12-09 11:38 EST, Bastien Nocera
no flags Details
gnome-system-monitor-dont-truncate-sizes.patch (2.15 KB, patch)
2005-12-14 13:20 EST, Bastien Nocera
no flags Details | Diff
gnome-system-monitor-dont-truncate-sizes-2.patch (2.88 KB, patch)
2005-12-15 04:41 EST, Bastien Nocera
no flags Details | Diff
gnome-system-monitor-dont-truncate-sizes-3.patch (3.68 KB, patch)
2006-01-09 10:22 EST, Bastien Nocera
no flags Details | Diff

  None (edit)
Description Bastien Nocera 2005-12-09 11:38:15 EST
On x86-64:

A process shows "5.9g" under RES in top, but 1.9GB in gnome-system-monitor.
Another process shows "9.5g" under RES in top, but -800567296 bytes in

Attached is a test program to get the vsize out of the program.
I think that the problem is either:
- in libgtop, getting the process' stats (couldn't replicate)
- in gnome-system-monitor itself (possibly bad conversion of one type to another)
- in gnome-vfs, for early versions of gnome-system-monitor, for
Comment 1 Bastien Nocera 2005-12-09 11:38:15 EST
Created attachment 122080 [details]
Comment 2 Bastien Nocera 2005-12-14 12:13:13 EST
Program to replicate the problem:

11560 root      16   0 10.0g  10g  232 S  0.0 15.9   1:51.38 test

#include <stdlib.h>
#include <string.h>

int main (int argc, char **argv)
        void *mem;
        /* 10 gigs*/
        mem = malloc (10737418240);
        if (mem == NULL) {
                printf ("Couldn't allocate the RAM\n");
                return 1;
        memset(mem, 0, 10737418240); /* may take a while, needed otherwise the
allocation isn't dirty, and shows as virt */
        for (;;)
                sleep (2);
        return 0;
Comment 3 Bastien Nocera 2005-12-14 12:20:18 EST
# ./test-glibtop 11560
PID: 11560
vsize: 10739855360

Seems to show it fine, so the bug is most likely not in libgtop.
Comment 4 Bastien Nocera 2005-12-14 12:34:31 EST
gnome_vfs_format_file_size_for_display() works as well:
# ./test-glibtop 11560
PID: 11560
vsize: 10739855360
Human form: 10.0 GB
Comment 5 Bastien Nocera 2005-12-14 12:44:58 EST
The bug is in src/util.c in gnome-system-monitor:
gchar *
get_size_string (gfloat fsize)

The gint64 gets truncated to a float, which will obviously break badly. Already
fixed upstream:
Comment 6 Bastien Nocera 2005-12-14 13:20:41 EST
Created attachment 122234 [details]
Comment 7 Bastien Nocera 2005-12-14 13:21:31 EST
Test packages at:
Comment 8 Bastien Nocera 2005-12-14 14:16:32 EST
The packages won't work, struct _ProcInfo in src/procman.h stores the memory
details in an int, instead of a gint64.
Comment 9 Bastien Nocera 2005-12-15 04:41:58 EST
Created attachment 122268 [details]

Also use gint64 to store the memory data temporarily.
Comment 10 Bastien Nocera 2005-12-15 04:42:37 EST
Test packages at:

(Verified working)
Comment 11 Bastien Nocera 2005-12-15 07:52:41 EST
Tested successfully.
Comment 14 Søren Sandmann Pedersen 2005-12-15 16:47:36 EST
Thanks for doing all this work, Bastien.
Comment 15 Bastien Nocera 2006-01-09 10:22:35 EST
Created attachment 122949 [details]

Also fix the sorting, using gint64, instead of gint, as for RHEL3 (bug #175377)
Comment 16 Søren Sandmann Pedersen 2006-01-09 13:53:32 EST
I have built a new version with this patch:

Comment 19 Søren Sandmann Pedersen 2006-04-11 16:57:53 EDT
Devel ACK - Note that this can be fasttracked. The package is there already,
Comment 26 Red Hat Bugzilla 2006-05-10 18:19:00 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.