From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8918 invoked by alias); 8 Feb 2008 03:14:43 -0000 Received: (qmail 8677 invoked by uid 48); 8 Feb 2008 03:14:00 -0000 Date: Fri, 08 Feb 2008 03:14:00 -0000 Message-ID: <20080208031400.8676.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug libfortran/35063] [Regression wrt g77] I/O leaks handles/memory on Windows XP In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jvdelisle at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-02/txt/msg00923.txt.bz2 ------- Comment #21 from jvdelisle at gcc dot gnu dot org 2008-02-08 03:14 ------- The problem manifests with: $ gfc -v Using built-in specs. Target: i686-pc-cygwin Configured with: ../gcc43/configure --prefix=/usr/local/gfortran --enable-languages=c,fortran --disable-bootstrap --enable-threads=posix --enable-sjlj-exceptions --enable-version-specific-runtime-libs --enable-nls --disable-libmudflap --disable-shared --disable-win32-registry --with-system-zlib --enable-checking=release --enable-werror --without-included-gettext --without-x --enable-libgomp Thread model: posix gcc version 4.3.0 20080128 (experimental) [trunk revision 131899] (GCC) I removed the mutex_lock code from the relevant sections of libgfortran/io/unit.c for internal units and the handle count growth goes away. This confirms the problem. I am still working the solution and have two approaches. One is to modify the mutex_unlock to delete the semaphore created and thus release the handle (Danny Smith idea). The other is to keep track of units assigned as internal and not create a new unit structure, but reuse the old. Stay tuned. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35063