X-Spam-Check-By: sourceware.org Date: Tue, 23 Jan 2007 09:37:53 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Perl bug? Message-ID: <20070123083753.GE27843@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <20070122181727 DOT GC27843 AT calimero DOT vinschen DOT de> <1552 DOT 67 DOT 40 DOT 28 DOT 188 DOT 1169493973 DOT squirrel AT 67 DOT 40 DOT 28 DOT 188> <20070122202137 DOT GC20665 AT calimero DOT vinschen DOT de> <45B540FF DOT 6060101 AT x-ray DOT at> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <45B540FF.6060101@x-ray.at> User-Agent: Mutt/1.4.2.2i Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Jan 22 23:55, Reini Urban wrote: > Corinna Vinschen schrieb: > >#!/usr/bin/perl > >$a = "a" x (100 * 1024 * 1024); > >sleep 5; > >$b = "b" x (100 * 1024 * 1024); > >sleep 5; > >$c = "c" x (100 * 1024 * 1024); > >sleep 5; > > .... > > perl is made this way. All vars are still in scope and all vars together > require a lot of memory. > > How about: > #!/usr/bin/perl > { > my $a = "a" x (100 * 1024 * 1024); > sleep 5; > } > { > my $b = "b" x (100 * 1024 * 1024); > sleep 5; > } > { > my $c = "c" x (100 * 1024 * 1024); > sleep 5; > } > ... > > Than you get better mmap figures. Hello? Am I in the wrong movie? This is no serious application. I'm demonstrating a problem. Every allocation uses twice as much memory as necessary. This is no problem as long as the process doesn't eat up the virtual memory for a process. As soon as no memory is available, I'd expect the GC kicking in, but it doesn't. Half of the VM is used up for temporary memory and never free'd, not even when the VM is used up. This shows a memory leak. The GC apparently doesn't know about this temporary memory anymore, otherwise it would free it and try to reuse it. It doesn't. Use strace and you'll see. That's not hard to understand, is it? Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/