Nick Piggin <piggin@xxxxxxxxxxxxxxx> writes:
Philip Martin wrote:
Nick Piggin <piggin@xxxxxxxxxxxxxxx> writes:Well just run something that uses a lot of memory and doesn't
When the build finishes and there is no other activity, can youHow do I apply anonymous memory pressure?
try applying anonymous memory pressure until it starts swapping
to see if everything gets reclaimed properly?
do much else. Run a few of these if you like:
#include <stdlib.h>
#include <unistd.h>
#define MEMSZ (64 * 1024 * 1024)
int main(void)
{
int i;
char *mem = malloc(MEMSZ);
for (i = 0; i < MEMSZ; i+=4096)
mem[i] = i;
sleep(60);
return 0;
}
This is what free reports after the build
total used free shared buffers cached
Mem: 516396 215328 301068 0 85084 68364
-/+ buffers/cache: 61880 454516
Swap: 1156664 40280 1116384
then after starting 10 instances of the above program
total used free shared buffers cached
Mem: 516396 513028 3368 0 596 5544
-/+ buffers/cache: 506888 9508
Swap: 1156664 320592 836072
and then after those programs finish
total used free shared buffers cached
Mem: 516396 35848 480548 0 964 5720
-/+ buffers/cache: 29164 487232
Swap: 1156664 54356 1102308
It looks OK to me.