X-Recipient: archive-cygwin@delorie.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=Rmders8gIAP+KEgc1s0a2oFNSwFpYV9lgTck6viEwb4O651SsLKoa
	P5CyHw+q6e6pJXuiYW5DEnDyU+k7PcJUU+Tret415/7h0bidsJiI7QknPs6e0nkT
	Ufmv/kiplgynURMh8HvRdbuQznTLLrCUhjNNuqF/mOueCUMsrX3n4s=
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=mlVgwx0tgj3V9qi7vaoZu8MrR/0=; b=waIXnAYrBhlqs05SY+W0AOFieUi8
	xD3qggbNgG9jU4vMAiBK9j0HEF/Z0jBSrSftgULdRVriSwypvihqwzh5Rs0t0g1U
	jAGeM7/Tz10mEAbEonXjCyLiKd5yeiyXdCzcS2KAJu3xcEZgp/al5+YwE/yrtAS2
	T86YiBuruhDRvBw=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=AWL,BAYES_00,KHOP_PGP_SIGNED,NO_RELAYS autolearn=ham version=3.3.2
X-HELO: calimero.vinschen.de
Date: Fri, 30 Aug 2013 21:00:48 +0200
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: xz -9 : Cannot allocate memory
Message-ID: <20130830190048.GA21571@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <50A41697.3080406@tiscali.co.uk> <loom.20130829T155739-66@post.gmane.org> <loom.20130829T162752-851@post.gmane.org> <20130829151121.GR21571@calimero.vinschen.de> <87ioyowbq9.fsf@Rainer.invalid> <loom.20130830T111847-683@post.gmane.org> <20130830120244.GV21571@calimero.vinschen.de> <loom.20130830T143654-505@post.gmane.org> <20130830174631.GA8831@calimero.vinschen.de>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;	protocol="application/pgp-signature"; boundary="McQJJYUzjTUqtsGv"
Content-Disposition: inline
In-Reply-To: <20130830174631.GA8831@calimero.vinschen.de>
User-Agent: Mutt/1.5.21 (2010-09-15)

--McQJJYUzjTUqtsGv
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Aug 30 19:46, Corinna Vinschen wrote:
> On Aug 30 12:58, Achim Gratz wrote:
> > Corinna Vinschen <corinna-cygwin <at> 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.
> >=20
> > Sorry if I'm dense, but does this mean that setting the default heap si=
ze 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.
> >=20
> > So, even though that rather large heap is essentially unused at the poi=
nt of
> > failure and there is enough memory free just beyond the heap, the alloc=
ation
> > still fails because both the existing heap and the free space are both
> > smaller than what's requested?
>=20
> 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.


Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--McQJJYUzjTUqtsGv
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)

iQIcBAEBAgAGBQJSIOvgAAoJEPU2Bp2uRE+gEo8QAInPGyNMF73yKmwnh2vp6DK9
mkEDzbF2UFx1KdMlJJH2YaUI7V5Q7A8C9QYtabLqhOvEUu10EbLUTcDpQw7NTrxI
EC4a3/K5SQdMk/nxhKZEbCYN8l15VLEeuS3twLAzFt/cFaG5ptWpmHUnSoE1j7A2
3Vfs451rXG5n5yKKObwH8ruyXMOx0LXEBUBGB6iE5jMpVaXcplbZQYFrtgtBYksi
aDQlX8xWB0dUu8hEwyuREVzCNas9acueof4MvBloMpWNtZrGydZ2ajs33JZtpzI7
Loo2VqkJ48xEie5eoudHCL0BrRD+wwoxTFMnvjzBN1JRG4uu+/ipeup7bSQ64+lj
aBGbRwFmi7ROhUVSoBpNnxUv8G7wr4JREWsuHJn6gnNx1pXLllxq/WfmzrNMtdfa
IF39XaOu5rHEO0Qh372Db79cEcu4J4elyyfL9NwJgEYKo6ZK4uzIMWWmfgLesubc
yxB3eYGheAb8SQfKp1QV5fJ3OYI0w05syXsGsElUp/AAEZ2CRG/qlbkGVmK8hR72
FY4gTeXXffevZGnu3nzSjg5NAEf5LRGjypKT/0rRNM6vOGkJ2hud7B8nedJBjIt8
J57LpOrV32gsx9F9QI0zgSYXEudTGF3c52hzn9QWVLLFtmmGvno3lmKZ/2QQpmG/
CItStdaQGhdH5FU/Iads
=+Ckz
-----END PGP SIGNATURE-----

--McQJJYUzjTUqtsGv--
