Re: [BUG][2.6.13.4] Memoryleak - idr_layer_cache slab - inotify?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stefan Jones wrote:

I noticed this a while back when gam_server (new fam replacement)
started playing up and the idr_layer_cache slab used up 300Mb of RAM.

To reproduce:

Run gnome and make sure it is using gam_server for fam.

In one console do:

while true ;do sleep 0.1 ; killall -w gam_server; done

In another try slabtop and see the idr_layer_cache slab climb, eating
memory (abit slowly).
( Gnome restarts gam_server after each kill for you and gets it doing
stuff )

I looked though the source and inotify does use the idr_layer_cache slab
and gam_server also uses inotify.

Made a standalone testcase, run this and the kernel will eat up your memory (seen via slabtop):

( this should compile everywhere )

#include <sys/wait.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/select.h>
#include <asm/unistd.h>
#include <errno.h>


#define __NR_inotify_init    291
#define __NR_inotify_add_watch    292
#define __NR_inotify_rm_watch    293


_syscall0(int, inotify_init);
_syscall3(int, inotify_add_watch, int, fd, const char *, name, unsigned int, mask);
_syscall2(int, inotify_rm_watch, int, fd, unsigned int, wd);

int main() {
   pid_t pid;
   int fd;
   int wd;
   const char *dirname=".";
   unsigned int mask = 0xffffffff;
   int stat;
for(;;) {
       if(!(pid = fork())) {
           fd = inotify_init ();

           wd = inotify_add_watch (fd, dirname, mask);
           if (wd < 0)
               perror ("inotify_add_watch");

           kill(getpid(),SIGTERM);
       }
       waitpid(pid,&stat,0);
   }
return 0;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux