From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111292 invoked by alias); 27 Jul 2015 20:15:24 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 111282 invoked by uid 89); 27 Jul 2015 20:15:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 X-HELO: calimero.vinschen.de Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 27 Jul 2015 20:15:22 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id 39AE2A8084F; Mon, 27 Jul 2015 22:15:19 +0200 (CEST) Date: Mon, 27 Jul 2015 20:15:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: Cygwin Shell Fails to Start when Enabling High Address Message-ID: <20150727201519.GB12449@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <20150224213422.GS437@calimero.vinschen.de> <56960a5bb2344de09875b4d117bf19b4@ntmaexbe03.bedford.progress.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="IiVenqGWf+H9Y6IX" Content-Disposition: inline In-Reply-To: <56960a5bb2344de09875b4d117bf19b4@ntmaexbe03.bedford.progress.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2015-07/txt/msg00414.txt.bz2 --IiVenqGWf+H9Y6IX Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 3135 On Jul 27 18:41, Benjamin Cao wrote: > Hi, >=20 > We are revisiting our issue with running Cygwin by enabling the > AllocationPreference registry to run in high address. We=E2=80=99re hoping > some clarification from our colleague could help shed some light on > our situation. >=20 > =E2=80=9CA major part of the work we did in the NT64 port was making sure= that > 64-bit pointers are not truncated to 32 bits. Most of the time you can > get away with a truncated pointer because the address is in the lower > 4GB of the address space and the upper 32 bits of the 64-bit pointer > are not used. The AllocationPreference=3D0x100000 setting forces memory > allocations to use addresses above 4GB so that the upper 32 bits of > 64-bit pointers are used. This can uncover bugs that would otherwise > not be found until a process has used a lot of memory. Rather than > stressing the machines by having every test allocate a ton of memory > we can use this setting to accomplish the same thing. This testing has > found several bugs in existing code and it helps guard against > developers making the mistake of truncating pointers in new code.=E2=80=9D >=20 > This is a setting supported by Microsoft (see below). > The AllocationPreference registry setting is documented on Microsoft=E2= =80=99s website: https://msdn.microsoft.com/en-us/library/windows/hardwar= e/dn613975(v=3Dvs.85).aspx >=20 > Usually, VirtualAlloc returns virtual addresses in low -> high order. > So, unless your process allocates a lot of memory or it has a very > fragmented virtual address space, it will never get back very high > addresses. This is possibly hiding bugs related to high addresses. > There is a simple way to force allocations in top -> down order in > Windows Server 2003, Datacenter Edition and Enterprise Edition > operating systems and this can reveal important bugs. >=20 > It=E2=80=99s important that we have this registry enabled for our work an= d if > your answer is still the same as before, will getting a support > contract enable us to get this capability? So you're talking about a 64 bit application? You didn't say so in your OP. Anyway, I'm very much puzzled. Either your application is a native Windows, non-Cygwin application using VirtualAlloc. Then it doesn't matter how Cygwin handles memory for it's own processes to you since the memory allocations in your process have nothing to do with Cygwin's allocation style. Or it's a POSIX application ported to Cygwin. In this case you shouldn't use VirtualAlloc but malloc or mmap, and the way memory gets allocated is not in your realm, but in Cygwin's. Also, on 64 bit Cygwin all memory (except thread stacks) is allocated beyond 0x1:0000000 anyway. On 32 bit with 3gb/4gt setting or on WOW64, the heap used for malloc allocations < 256K is beyond 0x80000000 and mmap s are allocated top down, so they start beyond 0x80000000 as well. So a Cygwin application is either high memory clean or it will crash. Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --IiVenqGWf+H9Y6IX Content-Type: application/pgp-signature Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJVtpFXAAoJEPU2Bp2uRE+gdYkP/iuLqn0k6kPAZ54aMMjGVjJb FCUEzY28z+lagPxQOePWupBobvpICco/+1huajVehJdIgYPga/HKPzqNeAmS4pxo WVQS63YVK5dZ1WdVfihuE4y+ui/bKVfIVu/s/D2G98jzMKPBB12TWl+NfUNxleoh eWGkPoyWzpObSo1zl8O9ZzQore8Q/WS4NxRUsVEA3ktajC5lcyYNdLbrvbrBQkrq 6KRtXAmMN6IFBckJHBG6nu3tpB1hk5C3vJ3LmDfPPE/Gz4nV+QSfClDF+Cfj+vsK PAxr0TVTQnLvpsWTd84j92KZDPnNQgVUZ3P6s7mhrYnMrnCarZxP9TdFEM4JS3Zt jVDwfdJF6X0SEzXX5ZDL3J0Dry+KT4iOZ79ly/0HZKA8yQc0LuiioV6RyFez7kjJ hhLLgpzuzyB5CGb6xQhq1HgQvMjNPGB09sJ9aGbVpO5jisB7THQXOCLzZvs1fc19 micWiaf+3gmQ4qEjbQfnx2+4EjfgFsJsVYuBecEdQ9wKelIG3zL5gQKR8ZVuN9y4 s15Mj2KyW8ta1IeArn5BVBQkBZhAJu0iWku42yeaZ8ODZu+kiIQ48L8mVDrg4U4H Dg3afLk2vRqgI9okaC07EtuUcDpluZl5dxYIBDeMw2oJQqmDp32NJ19fmKV17uPX 9TBOFHDBcAGjmBWNbBJh =Fcda -----END PGP SIGNATURE----- --IiVenqGWf+H9Y6IX--