I created a program just to amuse me. I consumes a lot of memory and
never gives it up:
#incluse <stdio.h>
#include <stdlib.h>
int main(void) {
void *a;
while(1)
a = malloc(99999);
}
but the output of vmstat (on GNU/Linux) is a very constant as:
procs -----------memory---------- ---swap-- -----io---- -system-- ----
cpu----
r b swpd free buff cache si so bi bo in cs us
sy id wa
1 0 0 157292 51668 201972 0 0 97 23 379 408 10
8 80 2
procs -----------memory---------- ---swap-- -----io---- -system-- ----
cpu----
r b swpd free buff cache si so bi bo in cs us
sy id wa
1 0 0 157276 51676 201972 0 0 97 23 379 407 10
9 80 2
procs -----------memory---------- ---swap-- -----io---- -system-- ----
cpu----
r b swpd free buff cache si so bi bo in cs us
sy id wa
1 0 0 157260 51684 201972 0 0 96 23 379 407 10
9 79 2
procs -----------memory---------- ---swap-- -----io---- -system-- ----
cpu----
r b swpd free buff cache si so bi bo in cs us
sy id wa
1 0 0 157276 51692 201972 0 0 96 23 379 407 10
9 79 2
procs -----------memory---------- ---swap-- -----io---- -system-- ----
cpu----
r b swpd free buff cache si so bi bo in cs us
sy id wa
1 0 0 157292 51700 201972 0 0 96 23 379 406 10
9 79 2
procs -----------memory---------- ---swap-- -----io---- -system-- ----
cpu----
r b swpd free buff cache si so bi bo in cs us
sy id wa
1 0 0 157276 51708 201972 0 0 96 23 379 406 10
9 79 2
procs -----------memory---------- ---swap-- -----io---- -system-- ----
cpu----
r b swpd free buff cache si so bi bo in cs us
sy id wa
1 0 0 157292 51716 201972 0 0 96 23 379 405 10
9 79 2
showinf free memory almost constant.