From: Magnus Andersson <magan029@student.liu.se>
To: linux-kernel@vger.kernel.org
Subject: 2.4.22 O_DIRECT memory leak?!?
Date: Wed, 8 Oct 2003 18:09:19 +0200 [thread overview]
Message-ID: <20031008180919.A6172@student.liu.se> (raw)
[-- 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
next reply other threads:[~2003-10-08 16:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-08 16:09 Magnus Andersson [this message]
2003-10-09 19:37 ` Marcelo Tosatti
2003-10-10 11:23 ` Magnus Andersson
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=20031008180919.A6172@student.liu.se \
--to=magan029@student.liu.se \
--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
all inboxes | Powered by JetHome®