Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
rump_sys_rename & tmpfs ... memory leak ?
Hi,
While learning how to use rump, i encountered a possible memory leak
with rump_sys_rename(), when run on a tmpfs mount.
The attached sample, seems to leaks some memory (about 4MB/sec on my
amd64) ... And the problem goes away if i remove/comment the
rump_sys_rename() call. I tried some other fs, but failed to reproduce
the problem.
Thanks in advance,
Regards.
njoly@lanfeust [~]> uname -a
NetBSD lanfeust.sis.pasteur.fr 5.99.11 NetBSD 5.99.11 (LANFEUST) #10: Tue Apr
28 11:45:16 CEST 2009
njoly%lanfeust.sis.pasteur.fr@localhost:/local/src/NetBSD/obj.amd64/sys/arch/amd64/compile/LANFEUST
amd64
njoly@lanfeust [~]> cc -lrumpfs_tmpfs -lrumpvfs -o tmpfs_rename tmpfs_rename.c
njoly@lanfeust [~]> ./tmpfs_rename
[...EATS ALL MEMORY...]
--
Nicolas Joly
Biological Software and Databanks.
Institut Pasteur, Paris.
#include <rump/rump_syscalls.h>
#include <rump/rump.h>
#include <sys/types.h>
#include <sys/mount.h>
#include <fs/tmpfs/tmpfs_args.h>
#include <err.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define MNTDIR "/"
#define FILE1 MNTDIR "foobar"
#define FILE2 MNTDIR "barfoo"
int main() {
int res, fd;
struct tmpfs_args args;
res = rump_init();
if (res != 0)
err(1, "rump_init failed");
memset(&args, 0x0, sizeof(args));
args.ta_version = TMPFS_ARGS_VERSION;
args.ta_root_mode = 0777;
args.ta_size_max = 10000 * 512;
res = rump_sys_mount(MOUNT_TMPFS, MNTDIR, 0, &args,
sizeof(args));
if (res == -1)
err(1, "mount failed");
while (1) {
fd = rump_sys_open(FILE1, O_WRONLY|O_CREAT|O_TRUNC, 0666);
rump_sys_close(fd);
rump_sys_rename(FILE1, FILE2);
}
res = rump_sys_unmount(MNTDIR, MNT_FORCE);
if (res == -1)
err(1, "mount failed");
return 0; }
Home |
Main Index |
Thread Index |
Old Index