From owner-freebsd-hackers@FreeBSD.ORG Fri May 15 11:48:52 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ACC34106566C for ; Fri, 15 May 2009 11:48:52 +0000 (UTC) (envelope-from marius@nuenneri.ch) Received: from mail-gx0-f172.google.com (mail-gx0-f172.google.com [209.85.217.172]) by mx1.freebsd.org (Postfix) with ESMTP id 73CA88FC08 for ; Fri, 15 May 2009 11:48:52 +0000 (UTC) (envelope-from marius@nuenneri.ch) Received: by gxk20 with SMTP id 20so1465019gxk.19 for ; Fri, 15 May 2009 04:48:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.151.135.12 with SMTP id m12mr5848630ybn.70.1242388131831; Fri, 15 May 2009 04:48:51 -0700 (PDT) In-Reply-To: <814ovqn8dp.fsf@zhuzha.ua1> References: <814ovqn8dp.fsf@zhuzha.ua1> Date: Fri, 15 May 2009 13:48:51 +0200 Message-ID: From: =?ISO-8859-1?Q?Marius_N=FCnnerich?= To: Mikolaj Golub Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: Memory leak on thread removal X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 11:48:52 -0000 On Tue, May 12, 2009 at 08:27, Mikolaj Golub wrot= e: > Hi, > > The code below is compiled with -fopenmp and run on FreeBSD6/7 (i386, amd= 64): > > #include > #include > > int n =3D 4, m =3D 2; > > int main () { > =A0 =A0 =A0 =A0for (;;) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0int i; > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//sleep(2); > #pragma omp parallel for num_threads(m) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0for(i =3D 0; i < 1; i++) {} > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//sleep(2); > #pragma omp parallel for num_threads(n) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0for(i =3D 0; i < 1; i++) {} > > =A0 =A0 =A0 =A0} > > =A0 =A0 =A0 =A0return 0; > } > > During the run the program's virtual memory usage constantly grows. The g= rowth > is observed only when n !=3D m. When running the program with uncommented > sleep() and observing the number of threads with 'top -H' I see in turn 2= or 4 > threads. So it looks like memory leak when thread is removed. Should I fi= ll > PR? I can confirm this. I briefly looked through the libgomp code but didn't see the leak. Anybody knows good tools how to investigate this?