mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Lang <david.lang@digitalinsight.com>
To: "Kristian Sørensen" <ks@cs.aau.dk>
Cc: linux-kernel@vger.kernel.org, umbrella@cs.aau.dk
Subject: Re: Gigantic memory leak in linux-2.6.[789]!
Date: Fri, 22 Oct 2004 17:51:04 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.60.0410221743590.20604@dlang.diginsite.com> (raw)
In-Reply-To: <200410221613.35913.ks@cs.aau.dk>

On Fri, 22 Oct 2004, Kristian Sørensen wrote:

> Hi all!
>
> After some more testing after the previous post of the OOPS in
> generic_delete_inode, we have now found a gigantic memory leak in Linux 2.6.
> [789]. The scenario is the same:
<SNIP>
> When the loop has completed, the system use 124 MB memory more _each_ time....
> so it is pretty easy to make a denial-of-service attack :-(
>
> We have tried the same test on a RHEL WS 3 host (running a RedHat 2.4 kernel)
> - and there is no problem.
>
>
> Any deas?
>
> --
> Kristian Sørensen
> - The Umbrella Project
>  http://umbrella.sourceforge.net

This is a common mistake that many people make when first looking at the 
Linux stats.

Linux starts off with most of the memory free, but rapidly uses it up. it 
keeps a small amount (a few megs) free at all times, but for the rest 
counts of freeing memory (possibly by swapping) when a new program asks 
for memory and there is less then the minimum amount left free.

It does this becouse there is a chance that the memory will be re-used (in 
your example where you were untaring the kernel source there is a chance 
that someone else would be reading that source and if they did it would 
already be in memory and not have to be re-read from disk) and becouse 
there is a chance that nothing will ever need to use that memory before 
the computer is shut off so it would be a waste of time to do the free 
(which includes zeroing out the memory, not just marking it as available).

This puts the cost of zeroing out and freeing memory on new programs that 
are allocating memory, which tends to scatter the work over time rather 
then having a large burst of work kick in when a program exits (it seems 
odd to think that if a large computer exits the machine would be pegged 
for a little while while it frees up and zeros the memory, not exactly 
what you would expect when you killed a program :-)

David Lang

-- 
There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies.
  -- C.A.R. Hoare

  parent reply	other threads:[~2004-10-23  1:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-22 14:13 Kristian Sørensen
2004-10-22 14:32 ` Kasper Sandberg
2004-10-22 15:07   ` Richard B. Johnson
2004-10-22 15:50     ` Kristian Sørensen
2004-10-22 16:12       ` Richard B. Johnson
2004-10-22 19:24         ` Kristian Sørensen
2004-10-22 19:20           ` Richard B. Johnson
2004-10-22 19:33           ` Chris Friesen
2004-10-22 16:15     ` Gene Heskett
2004-10-22 16:28       ` Andre Tomt
2004-10-22 16:32       ` Chris Friesen
2004-10-23  0:51 ` David Lang [this message]
2004-10-24 14:14   ` Bill Davidsen
2004-10-24 16:04     ` Tommy Reynolds
2004-10-25 22:11       ` Bill Davidsen
2004-10-25 22:47     ` David Lang
2004-10-23  1:44 ` Bernd Eckenfels

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=Pine.LNX.4.60.0410221743590.20604@dlang.diginsite.com \
    --to=david.lang@digitalinsight.com \
    --cc=ks@cs.aau.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=umbrella@cs.aau.dk \
    /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®