From: David Ashley <dash@xdr.com>
To: linux-kernel@vger.kernel.org
Subject: Re: Cache memory never gets released
Date: Fri, 25 Jun 2004 08:47:17 -0700 [thread overview]
Message-ID: <200406251547.i5PFlHNS000884@xdr.com> (raw)
Richard B. Johnson wrote:
>Are you sure you have a problem?
>...
>This is linux-2.4.26. If you are using an exprimental kernel,
>memory-allocation might be broken but is probably not.
Yes, I am absolutely sure I have a problem. The cached memory gets
lost so I can't ever use it again over time. I have a simple hog.c program
that just allocs blocks of 1M and fills them with data:
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
/* This program just hogs a lot of memory */
#define SIZE 0x100000
int main(int argc,char **argv)
{
char *p;
int i=0;
for(;;)
{
p=malloc(SIZE);
if(!p) break;
memset(p,0,SIZE);
i+=SIZE;printf("Allocated %dM\n",i/1000000);
// sleep(1);
}
exit(0);
}
On a pristine system I can work the cached line output by "free"
down to around 6M. After usage, over time, the cached amount works its
way up to be basically all of system memory, and I can't ever work it
down. The hog program above runs but the kernel kills it after only
a small amount of memory can be allocated.
I'm not doing anything mysterious. The kernel is stock 2.4.26 except for
some changes to these files:
Documentation/Configure.help
Makefile
arch/i386/config.in
drivers/sound/via82cxxx_audio.c
fs/proc/array.c
fs/proc/proc_misc.c
include/asm-i386/param.h
kernel/signal.c
kernel/sys.c
net/ipv4/icmp.c
Nothing related to caching/memory management has been touched. I've applied
the variable HZ patch so ticks happen 500/second up from 100/second.
Is there any valid reason why cached memory would stay locked at 54M for
example and never go lower, even when there are almost no processes running
on the system?
Thanks--
Dave
PS Is there some way that cached blocks can somehow form interdependencies?
For example block A can't be released until block B is, and vice-versa?
And that these can build up over time? This is the kind of behaviour I'm
seeing.
next reply other threads:[~2004-06-25 15:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-25 15:47 David Ashley [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-06-25 14:24 Cache memory never gets released David Ashley
2004-06-25 14:44 ` Richard B. Johnson
2004-06-25 0:31 David Ashley
2004-06-25 12:34 ` Marcelo Tosatti
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=200406251547.i5PFlHNS000884@xdr.com \
--to=dash@xdr.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.