mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan Jones <stefan.jones@churchillrandoms.co.uk>
To: linux-kernel@vger.kernel.org
Subject: Re: [BUG][2.6.13.4] Memoryleak - idr_layer_cache slab - inotify?
Date: Fri, 21 Oct 2005 11:53:55 -0700	[thread overview]
Message-ID: <43593943.8070901@churchillrandoms.co.uk> (raw)
In-Reply-To: <43593240.9020806@churchillrandoms.co.uk>

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;
}

  reply	other threads:[~2005-10-21 18:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-21 18:24 Stefan Jones
2005-10-21 18:53 ` Stefan Jones [this message]
2005-10-21 20:17 ` Stefan Jones
2005-10-21 20:48   ` Andrew Morton
2005-10-21 21:35     ` Stefan Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43593943.8070901@churchillrandoms.co.uk \
    --to=stefan.jones@churchillrandoms.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®