mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* 2.4.22 O_DIRECT memory leak?!?
@ 2003-10-08 16:09 Magnus Andersson
  2003-10-09 19:37 ` Marcelo Tosatti
  0 siblings, 1 reply; 3+ messages in thread
From: Magnus Andersson @ 2003-10-08 16:09 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 401 bytes --]

Hello!

If I open one file a lot of times using the flag O_DIRECT,
memory seems to be be lost and never given back to the system.
This is happening on some kernels, see below for which ones I tried.

Attached program will produce this behavior, also attached 
is the output from vmstat while running the program.

Affected:
2.4.22
2.4.22-ac4
2.4.23-pre6

Not affected:
2.4.22-aa1
2.6.0-test6

/Magnus

[-- Attachment #2: open_odirect.c --]
[-- Type: text/plain, Size: 531 bytes --]

#define _GNU_SOURCE

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>

#define NFDS 1000

#define ERR(args...) fprintf(stderr, args);

int main()
{
  int i, fds[NFDS];

  for(i = 0; i < NFDS; i++) {
    if((fds[i] = open("./file", O_RDONLY | O_DIRECT)) < 0) {
      ERR("main(): open(): %s\n", strerror(errno));
      exit(1);
    }
  }
  
  for(i = 0; i < NFDS; i++) {
    if(close(fds[i]) < 0) {
      ERR("main(): close(): %s\n", strerror(errno));
      exit(1);
    }
  }
}

[-- Attachment #3: vmstat.output --]
[-- Type: text/plain, Size: 955 bytes --]

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 498324    916   7632    0    0    54     9  109    22  1 19 80  0
 0  0      0 498320    916   7632    0    0     0     0  101     2  0  0 100  0
 0  0      0 498320    916   7632    0    0     0     0  101     2  0  0 100  0
 0  0      0 498320    916   7632    0    0     0     0  101     2  0  0 100  0
 0  0      0 498320    916   7632    0    0     0     0  101     2  0  0 100  0
 1  0      0 485072    916   7632    0    0     0     0  104    11  0  6 94  0
 0  0      0 386276    916   7632    0    0     0     0  116     7  0 41 59  0
 0  0      0 386276    916   7632    0    0     0     0  101     2  0  0 100  0
 0  0      0 386276    916   7632    0    0     0     0  101     2  0  0 100  0
 0  0      0 386276    916   7632    0    0     0     0  101     2  0  0 100  0

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-10-10 11:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-08 16:09 2.4.22 O_DIRECT memory leak?!? Magnus Andersson
2003-10-09 19:37 ` Marcelo Tosatti
2003-10-10 11:23   ` Magnus Andersson

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®