[Gllug] Memory Usage

Stephen Nelson-Smith sanelson at gmail.com
Mon Mar 10 22:48:15 UTC 2008


Hello,

We had a strange case where a 12G machine with a xen kernel, and 5 x
2GB VMs appeared not to release the 10G of RAM once the vms had been
stopped.  I had to reboot the machine to get that memory back.

Have I missed something?  Is there some "stop vms and reallocate the
memory" command that  I missed?

Incidentally (and thinking of the C thread on this list), one of the
developers wrote this to test:

int main(int argc, char **argv) {
    unsigned long lump = 2L * 1024L * 1024L * 1024L + 1L;
    unsigned char *thereabouts = (unsigned char *)malloc(lump);
    thereabouts[lump - 1L] = 'a';
    printf("0x%x (%u) bytes starting at %p\n",
                       lump, lump, thereabouts);
    return 0;
}

I can't see what this does that user level tools don't do, but my C is
dreadful.  Anyone care to elucidate?

eg:

$ ./more_than_2_gig
0x80000001 (2147483649) bytes starting at 0x2aaaaaab8010
$ free
             total       used       free     shared    buffers     cached
Mem:      12265472    2126744   10138728          0      23392    1624536
-/+ buffers/cache:     478816   11786656
Swap:      2031608          0    2031608

I suppose it gives an address?  But why is this valuable?

S,
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list