From owner-freebsd-bugs Sat Oct 10 07:20:06 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA11019 for freebsd-bugs-outgoing; Sat, 10 Oct 1998 07:20:06 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id HAA11010 for ; Sat, 10 Oct 1998 07:20:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id HAA17328; Sat, 10 Oct 1998 07:20:01 -0700 (PDT) Received: from online.no (pilt-s.online.no [193.212.1.34]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id HAA10917 for ; Sat, 10 Oct 1998 07:18:13 -0700 (PDT) (envelope-from zerium@zerium.dyn.ml.org) Received: from zerium.dyn.ml.org (ti34a26-0012.dialup.online.no [130.67.65.140]) by online.no (8.9.1/8.9.1) with ESMTP id QAA10151 for ; Sat, 10 Oct 1998 16:18:01 +0200 (MET DST) Received: (from zerium@localhost) by zerium.dyn.ml.org (8.9.1/8.9.1) id TAA20293; Fri, 9 Oct 1998 19:40:04 +0200 (CEST) (envelope-from zerium) Message-Id: <199810091740.TAA20293@zerium.dyn.ml.org> Date: Fri, 9 Oct 1998 19:40:04 +0200 (CEST) From: zerium@webindex.no Reply-To: zerium@zerium.dyn.ml.org To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: kern/8252: popen/pclose leaks Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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 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