X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=Z3Cq799T405Nb8T+SLEECW0kcR1ceJX8BpNQ5nHOdZo2rsheyxu9I tAFCBwJmd3Ar1n31lQfemn+Vyc0YKEbUzbmT9qzHzZMvPTpPLoL6TvGZsriXYn2n WIBrvX8cCnq+X2ZKnhvzFpJyVk9uKzo+gs22GHv2yi5UPFWQvbyLCk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=UaG2JExWm09i4Q54puoyqGcHW6s=; b=oaegBQQ/xR+7Fr/O3+PdAuTlShnl /7TLTfUsKSxv8OhmuLFTS/Bj0DkZsHtC4YvJ22Pi7llOaLgmVDwTxWWLY78C60Tp Jm2XTmc15aKRnTCQIICN1wDWRtIrbgcCMUgCBDlCcVo876FJn554uiQW48veaQqb vpRFFaZPfazYOLw= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.4 required=5.0 tests=AWL,BAYES_00,FSL_HELO_NON_FQDN_1,HELO_LOCALHOST,RCVD_IN_PBL,RCVD_IN_RP_RNBL,RCVD_IN_SORBS_DUL,RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mho-01-ewr.mailhop.org X-Mail-Handler: Dyn Standard SMTP by Dyn X-Report-Abuse-To: abuse AT dyndns DOT com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1/UREueO9JeoxmkGNR8OdpG Date: Fri, 30 Aug 2013 17:03:49 -0400 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: xz -9 : Cannot allocate memory Message-ID: <20130830210349.GA975@ednor.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <50A41697 DOT 3080406 AT tiscali DOT co DOT uk> <20130829151121 DOT GR21571 AT calimero DOT vinschen DOT de> <87ioyowbq9 DOT fsf AT Rainer DOT invalid> <20130830120244 DOT GV21571 AT calimero DOT vinschen DOT de> <20130830174631 DOT GA8831 AT calimero DOT vinschen DOT de> <20130830190048 DOT GA21571 AT calimero DOT vinschen DOT de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130830190048.GA21571@calimero.vinschen.de> User-Agent: Mutt/1.5.20 (2009-06-14) On Fri, Aug 30, 2013 at 09:00:48PM +0200, Corinna Vinschen wrote: >On Aug 30 19:46, Corinna Vinschen wrote: >> On Aug 30 12:58, Achim Gratz wrote: >> > Corinna Vinschen cygwin.com> writes: >> > > Yes, looks normal and expected from what you observed. mmap commits >> > > memory top-down and that was apparently the first free slot big enough >> > > to fullfil the request. The default heap size is 384 Megs and then >> > > there's apparently not enough space anywhere. >> > >> > Sorry if I'm dense, but does this mean that setting the default heap size to >> > zero does in fact mean it's trying to use 374MiB... wait, yes it is: the >> > memory map is the same when I'm setting the initial heap size to 384MiB with >> > peflags. >> > >> > So, even though that rather large heap is essentially unused at the point of >> > failure and there is enough memory free just beyond the heap, the allocation >> > still fails because both the existing heap and the free space are both >> > smaller than what's requested? >> >> Well, good question. You could debug the sbrk function and see why >> it fails to reserve the space. > >I just debugged this and it seems our sbrk implementation has a serious >problem to extend the heap if the new chunk of memory requires to commit >some of the existing heap and to reserve and commit some more space. >It tries to reserve memory using the wrong address and the wrong size. >It also uses a too simple method to commit the memory. I'll apply a fix >shortly. It looked fine to me. The only code change that I did make was to change your coercion of pointers to ptrdiff_t types into (char *), since that is more in keeping with the rest of the code. I had a hard time reading the code with all of the cygheap-> pointers so I changed two functions to be a user_info_heap methods. That, IMO, makes the code faster and more readable. You probably saw that I fixed the USR1/USR2 issue. That was a serious signal bug. I think both of those warrant a new release in fact. cgf -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple