high virtual memory usage in openvz?

Posted by freedrull on Super User See other posts from Super User or by freedrull
Published on 2011-11-12T00:25:21Z Indexed on 2011/11/12 1:58 UTC
Read the original article Hit count: 480

Filed under:
|
|

We're having a lot of memory problems on a new OpenVZ box. It is supposed to have 1 gig of memory, I'm not sure how much of that is burstable or guaranteed memory. Programs in general seem to take up more virtual memory than they do on my box at home, and on our other OpenVZ box.

I wrote this simple C program:

#include <stdio.h>
#include <stdlib.h>

int main(){
  char *thingy = malloc(500);
  getchar():
  return 0;
}

So it simply allocates 500 bytes and then returns. I ran the program on 3 computers. On my home machine, and our other OpenVZ box it shows about 1k bytes of virtual memory being used. On the new problematic machine its about 3k.

I know this is just virtual memory and not resident memory, but why is this machine allocating so much virtual memory? Are there some settings I need to adjust to the OpenVZ memory settings?

I tried changing the stack size with ulimit -s 256 and restarting some demons, but I still saw the same results.

I'm doing all of my monitoring with htop, is this even a good program to use with a OpenVZ vps? I've read I should be parsing the output of /proc/user_beancounters intead or something.

© Super User or respective owner

Related posts about memory

Related posts about virtualization