public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Volkoff <vdb@mail.ru>
To: linux-kernel@vger.kernel.org
Subject: Re: Unfreeable buffer/cache problem in 2.4.17-rc1 still there
Date: Sun, 16 Dec 2001 22:39:09 +0300	[thread overview]
Message-ID: <20011216223909.A230@localhost> (raw)

Hello!

Below is simple test case which I think is related to "memory disappear"
problem.

My real program is doing something like this:

// test.c
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>

int main(void) 
{
  int fd;
  int r;
  char data[10] = "0123456789";
  int i;
  int end = 30;
  for (i=0;i<end;i++) {
    fd = open("testfile", O_WRONLY | O_NDELAY | O_TRUNC | O_CREAT, 0644);
    if (fd == -1) {
      printf("unable to open\n");
      return;
    }
    r = write(fd,data,sizeof data);
    if (r == -1) {
      printf("unable to write\n");
      close(fd);
      return;
    }
    close(fd);
    sleep(1);
  }
}
// end test.c

Each time I run `free; ./test; free` I see evergrowing memory usage. 
I mean used memory + buffers. At some point system just starts swapping 
even if no other processes are running. Tested on 2.4.13 and 
2.4.17-pre4aa1. I think something is wrong here because the very same 
test program does not show such behaviour on 2.2.19. It does not lose 
any single byte of memory. I've even tested this on freebsd-4.4 with 
the same result as on 2.2.19. 

Example output on 2.4.17-pre4aa1:

bash-2.03$ free; ./test; free
total       used       free     shared    buffers     cached
Mem:        514528     212508     302020          0       7952     150664
-/+ buffers/cache:      53892     460636
Swap:      1028120          0    1028120
total       used       free     shared    buffers     cached
Mem:        514528     212616     301912          0       8000     150664
-/+ buffers/cache:      53952     460576
Swap:      1028120          0    1028120

bash-2.03$ free; ./test; free
total       used       free     shared    buffers     cached
Mem:        514528     212616     301912          0       8008     150664
-/+ buffers/cache:      53944     460584
Swap:      1028120          0    1028120
total       used       free     shared    buffers     cached
Mem:        514528     212700     301828          0       8056     150664
-/+ buffers/cache:      53980     460548
Swap:      1028120          0    1028120

The results are very consistent. I lose 30-40 byte per run.

-- 

    DV

             reply	other threads:[~2001-12-16 19:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-16 19:39 Dmitry Volkoff [this message]
2001-12-17 17:01 ` Unfreeable buffer/cache problem in 2.4.17-rc1 still there vda
2001-12-18  4:26   ` Dmitry Volkoff
  -- strict thread matches above, loose matches on Subject: below --
2001-12-16 20:41 Willy Tarreau
     [not found] <Pine.LNX.4.33.0112151141280.19022-100000@coffee.psychology.mcmaster.ca>
2001-12-15 17:09 ` Chris Chabot
2001-12-15 16:05 Ed Tomlinson
2001-12-15 12:36 Chris Chabot
     [not found] ` <004601c18567$a8be1600$0801a8c0@Stev.org>
2001-12-15 13:42   ` Chris Chabot
2001-12-15 14:24 ` Andrea Arcangeli
2001-12-15 16:05   ` Chris Chabot
2001-12-15 16:09     ` Ken Brownfield

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=20011216223909.A230@localhost \
    --to=vdb@mail.ru \
    --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