[mythtv] system status reports wrong sizes

Kirk Anderson kirk at nosredna.net
Fri Feb 18 03:51:24 UTC 2005

I've noticed a number of times that whenever I would check out the
"System Status" section of the frontend, that it always reported a very
low number for my swap space.  I looked into it enough to ask the
following question:

Shouldn't the "getMemStats ()" method in "libs/libmyth/util.cpp" use the
"sinfo.mem_unit" field to determine the sizing of all other values in sinfo
before it simply divides everything by the macro "MB" (1024 * 1024) ?

The code in question follows:

#define MB (1024 * 1024)

bool getMemStats(int &totalMB, int &freeMB, int &totalVM, int &freeVM)
#ifdef __linux__
    struct sysinfo sinfo;
    if (sysinfo(&sinfo) == -1)
        VERBOSE(VB_ALL, "sysinfo() error");
        return false;
        totalMB = sinfo.totalram/MB,
        freeMB  = sinfo.freeram/MB,
        totalVM = sinfo.totalswap/MB,
        freeVM  = sinfo.freeswap/MB;

More information about the mythtv-dev mailing list