Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Oct 1998 19:40:04 +0200 (CEST)
From:      zerium@webindex.no
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/8252: popen/pclose leaks
Message-ID:  <199810091740.TAA20293@zerium.dyn.ml.org>

next in thread | raw e-mail | index | archive | help

>Number:         8252
>Category:       kern
>Synopsis:       popen/pclose leaks
>Confidential:   yes
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 10 07:20:01 PDT 1998
>Last-Modified:
>Originator:     Hans Petter Bieker
>Organization:
>Release:        FreeBSD 3.0-BETA i386
>Environment:

FreeBSD XXXXXXXXXX 3.0-BETA FreeBSD 3.0-BETA #2: Thu Oct  8 03:33:05 \
CEST 1998 root@XXXXXXXXXX:/usr/src/sys/compile/ZERIUM  i386

>Description:

A pclose() after a popen does not free all the uses memory.

This is only a problem in v3.0, not in v2.2.x.

The RCS diff between the popen.c in v2.2 and v3.0 is null, nil, no,
nothing. I'm not sure if the libc function calls leaks or if it's a kernel
problem.

>How-To-Repeat:

#include <stdio.h>

int
main(argc, argv)
	int             argc;
	char           *argv[];
{
	for (;;) {
		FILE           *pfile;

		pfile = popen("true", "r");
		if (!pfile)
			break;
		if (pclose(pfile) == -1)
			break;
	}

	return 0;
}

run it and watch the process grow:
zerium 14211  0.0  0.6   804  452  v0  S+    5:56pm   0:00.06 myprocess
zerium 14211  4.9  0.8   948  596  v0  S+    5:56pm   0:00.23 myprocess
zerium 14211  5.3  1.1  1208  856  v0  S+    5:56pm   0:00.54 myprocess
zerium 14211  5.3  1.4  1500 1148  v0  R+    5:56pm   0:00.87 myprocess
zerium 14211  5.7  1.9  1860 1508  v0  S+    5:56pm   0:01.29 myprocess
zerium 14211  5.5  2.4  2228 1876  v0  S+    5:56pm   0:01.72 myprocess
zerium 14211  5.5  3.1  2832 2480  v0  S+    5:56pm   0:02.42 myprocess
zerium 14211  5.9  3.4  3076 2724  v0  S+    5:56pm   0:02.70 myprocess
zerium 14211  6.3  3.8  3372 3020  v0  S+    5:56pm   0:03.05 myprocess
zerium 14211  5.9  4.2  3712 3360  v0  S+    5:56pm   0:03.45 myprocess
                        ^^^^ ^^^^
>Fix:
	
N/A
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810091740.TAA20293>