mmap() read of files on pvfs results in memory being leaked by the kernel module. Memory is not recovered by restarting pvfs2-client-core. This example output and source code shows what happens when reading a 64M file:
$ dd if=/dev/zero of=/mnt/pvfs2/boom.dat bs=1M count=64
$ free
total used free shared buffers cached
Mem: 2034016 1312120 721896 0 73856 546168
-/+ buffers/cache: 692096 1341920
Swap: 4770320 0 4770320
$ ./foo /mnt/pvfs2/boom.dat
$ free
total used free shared buffers cached
Mem: 2034016 1380216 653800 0 73908 547456
-/+ buffers/cache: 758852 1275164
Swap: 4770320 0 4770320
Source code for foo:
#include <stdio.h>
#include <errno.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
int fd;
char* addr;
int i;
char* tmp;
fd = open(argv[1], (O_RDWR), (S_IRUSR|S_IWUSR));
if(fd < 0)
{
perror("open");
return(-1);
}
addr = mmap(NULL, (1024*1024*64), PROT_READ, MAP_PRIVATE, fd, 0);
if(!addr)
{
perror("mmap");
return(-1);
}
tmp = malloc(1024*1024*64);
if(!tmp)
{
perror("malloc");
return(-1);
}
for(i=0; i<(1024*1024*64); i++)
{
tmp[i] = addr[i];
}
close(fd);
return(0);
}