0

I am trying to access High Memory and High Free Memory so that i can pick up what are the available percentage of user memory space.

When i try the sysinfo API, i get accurate information for the total RAM and total free RAM. i.e.

if(sysinfo(&l_sys_info) == 0)
{
    //Print Different Fields here
    return;
}

The fields

unsigned long totalhigh; /* Total high memory size */
unsigned long freehigh;  /* Available high memory size */

are always 0.

The documentation for sysinfo is here: http://man7.org/linux/man-pages/man2/sysinfo.2.html

So i tried to read the same values from the proc/meminfo file and i can't find the fields:

HighTotal:

HighFree: Highmem is all memory above ~860MB of physical memory Highmem areas are for use by userspace programs, or for the pagecache. The kernel must use tricks to access this memory, making it slower to access than lowmem.

The documentation of proc/meminfo can be found here http://man7.org/linux/man-pages/man5/proc.5.html

Are these fields absent in certain Kernel Versions? or certain flavors?

I got the same result for Linux Kernel Versions 3.0.38 and 2.6.32-55.

shellter
  • 36,525
  • 7
  • 83
  • 90
Desert Ice
  • 4,461
  • 5
  • 31
  • 58
  • 1
    It's probably not configured. CONFIG_HIGHMEM is required. – kec May 06 '14 at 13:37
  • 1
    And it only applies to 32-bit kernels. With 64-bit pointers there's no need. There's a cycle here: our physical memory outgrows our pointer sizes, so we have to kludge around it. It happened when DOS machines crossed the 640K mark; it happened again when Linux/ia32 machines went past 1G. Then a new architecture steps up the pointer size (80386 in the first case, amd64 in the second case) and the kludges disappear for a while. The 64-bit architectures won't hit their memory limit for quite some time. –  May 06 '14 at 13:55

0 Answers0