From owner-freebsd-questions@FreeBSD.ORG Sun Mar 15 10:52:09 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CE5E1065674 for ; Sun, 15 Mar 2009 10:52:09 +0000 (UTC) (envelope-from cpghost@cordula.ws) Received: from fw.farid-hajji.net (fw.farid-hajji.net [213.146.115.42]) by mx1.freebsd.org (Postfix) with ESMTP id 224B88FC18 for ; Sun, 15 Mar 2009 10:52:09 +0000 (UTC) (envelope-from cpghost@cordula.ws) Received: from phenom.cordula.ws (phenom [192.168.254.60]) by fw.farid-hajji.net (Postfix) with ESMTP id 9CE2132F3D; Sun, 15 Mar 2009 11:52:07 +0100 (CET) Date: Sun, 15 Mar 2009 11:52:06 +0100 From: cpghost To: Wojciech Puchar Message-ID: <20090315105206.GB1282@phenom.cordula.ws> References: <20090315091301.GB1051@phenom.cordula.ws> <20090315100141.GA1282@phenom.cordula.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.19 (2009-01-05) Cc: freebsd-questions@freebsd.org Subject: Re: Speeding up exit(2)? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Mar 2009 10:52:09 -0000 On Sun, Mar 15, 2009 at 11:09:00AM +0100, Wojciech Puchar wrote: > >> > >> is it your program and you are sure it's on exit? > > > > Every memory hungry program is concerned; and yes: it happens exactly > > on exit. > > strange. > i just wrote a test program > > #include > int test[1024*1024*128]; > main() { > int a; > for(a=0;a<1024*1024*128;a++) test[a]=a; > puts("end"); > } > > it fills 512MB RAM and then ends. i have 256MB RAM in laptop > > it swapped a lot, then wrote "end" and immediately exited. Hmmm... yes, it's strange. With malloc-ed space, exit is also very fast. On a 2 GB machine with amd64, exit is almost immediate: ----- snip ---------------------------------------------- #include #include #include #include #define NRGIGS 4 #define BIGSIZE (1024*1024*1024) #define SOMETIME 15 main() { int a; char *p; for (a=0; a