xfs
[Top] [All Lists]

[Bug 290] New: XFS Kernel Memory Leak

To: xfs-master@xxxxxxxxxxx
Subject: [Bug 290] New: XFS Kernel Memory Leak
From: bugzilla-daemon@xxxxxxxxxxx
Date: Sat, 22 Nov 2003 14:05:53 -0800
Sender: linux-xfs-bounce@xxxxxxxxxxx
http://oss.sgi.com/bugzilla/show_bug.cgi?id=290

           Summary: XFS Kernel Memory Leak
           Product: Linux XFS
           Version: unspecified
          Platform: IA32
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: High
         Component: XFS kernel code
        AssignedTo: xfs-master@xxxxxxxxxxx
        ReportedBy: condor-sgi@xxxxxxxxxxxxx


This may (or may not) be related to bug 209, but here's what I have...

There is a memory leak in the opendir()/readdir()/closedir() code.  I've tested
this on the following kernels:

2.6.0-test9
2.6.0-test9-mm2
2.6.0-test9-mm5

I noticed this first when locate was updating its database every night... the
next morning nearly all available memory would be used and I'd have to reboot
the machine to reclaim it.

I wrote the following Perl script to test this:

----------------------------------------------
#!/usr/bin/perl

open_dir("/");

sub open_dir {
    my $pwd = shift;
    opendir(DIR, $pwd);
    my @dentries = readdir(DIR);
    closedir(DIR);

    foreach my $de (@dentries) {
        next if $de =~ /^\./;

        print "$pwd$de\n";

        if (! -l "$pwd$de" && -d "$pwd$de") {
            open_dir("$pwd$de/");
        }
    }
}
----------------------------------------------

I ran this script on my machine on a fresh boot, and vmstat at the same time,
and came up with a very gradual loss of memory (it looks linear in nature to my
untrained eye).  You can get the entire vmstat log from
http://www.condordes.net/~condor/vmstat.log .

As a contrast, here's a vmstat row from near the beginning:

procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
 0  0      0 453992  11056  21288    0    0   776    50 1111   299  1  3 97  0

And here's one towards the end:

procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
 2  0      0   3440 111464   7456    0    0    14    67 1010    42  1 98  1  0

During the run I also ran 'top' to make sure there weren't other processes
eating up RAM, so I'm fairly sure most of this lost memory is in kernel space.

If you have any additional tests you want me to run, please let me know.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


<Prev in Thread] Current Thread [Next in Thread>
  • [Bug 290] New: XFS Kernel Memory Leak, bugzilla-daemon <=