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:from:to:subject:date:message-id:references :in-reply-to:content-type:content-transfer-encoding :mime-version; q=dns; s=default; b=XMTA94gIZg9BQyTXSwn6Cwu8QxcLM 8f50i1hNZhV3viCzPPUqMJ1k9jMXmBh2Mhhb2ua0wXPwu8DKgxe5kTppl14rOjzm +VbhYx1mD17RSUi7+71V/G0PiUF2m9A1sq2PbJniG8CeNezzSB3ivLXDJQquMTqL 8Ungx/H+TebMlw= 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:from:to:subject:date:message-id:references :in-reply-to:content-type:content-transfer-encoding :mime-version; s=default; bh=xWQ7peO5hg4HdEI5X/2TbMXBeUY=; b=N/H 5m6TM96f7O8+1rDhR4vJcVsStJAs4juAmMVMRlupwFNLrnuF8xeZKJjqU3LMoiUC LnhPdnMZ8B3uSsngW2R1+vDhZIzD8y6FXWEJKmPcJ5WK3wbdPZLJ5lIK/irT/od9 BstyD9lbUAwO9uBRAo4/kZktmEnaKBj1Bx+MKguQ= 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=3.8 required=5.0 tests=AWL,BAYES_50,CYGWIN_OWNER_BODY,MIME_BASE64_BLANKS,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail1.bemta7.messagelabs.com X-Env-Sender: becao AT progress DOT com X-Msg-Ref: server-4.tower-166.messagelabs.com!1438104368!30012162!1 X-StarScan-Received: X-StarScan-Version: 6.13.16; banners=-,-,- X-VirusChecked: Checked From: Benjamin Cao To: "cygwin AT cygwin DOT com" Subject: RE: Cygwin Shell Fails to Start when Enabling High Address Date: Tue, 28 Jul 2015 17:26:03 +0000 Message-ID: References: <20150224213422 DOT GS437 AT calimero DOT vinschen DOT de> <56960a5bb2344de09875b4d117bf19b4 AT ntmaexbe03 DOT bedford DOT progress DOT com> <20150727201519 DOT GB12449 AT calimero DOT vinschen DOT de> In-Reply-To: <20150727201519.GB12449@calimero.vinschen.de> x-ms-exchange-transport-fromentityheader: Hosted x-ems-proccessed: x-ems-stamp: NaMCOwM+l3ZPrJvMdFZQXQ== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-IsSubscribed: yes Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id t6SHQNkL003448 Corinna, When I start Cygwin, with the AllocationPreference registry enable for VirtualAlloc, the shell immediate closes. I get the below error. 2 [main] sh 5240 c:\cygwin\bin\sh.exe: *** fatal error - internal error reading the windows environment - too many environment variables? I guess you have answered the question to when we could get our testing running on Cygwin, but I'm unable to get to that point if the shell cannot start. Any advice on what I'm seeing now? -----Original Message----- From: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com] On Behalf Of Corinna Vinschen Sent: Monday, July 27, 2015 4:15 PM To: cygwin AT cygwin DOT com Subject: Re: Cygwin Shell Fails to Start when Enabling High Address On Jul 27 18:41, Benjamin Cao wrote: > Hi, > > We are revisiting our issue with running Cygwin by enabling the > AllocationPreference registry to run in high address. We’re hoping > some clarification from our colleague could help shed some light on > our situation. > > “A 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=0x100000 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.” > > This is a setting supported by Microsoft (see below). > The AllocationPreference registry setting is documented on Microsoft’s website: https://msdn.microsoft.com/en-us/library/windows/hardware/dn613975(v=vs.85).aspx > > 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. > > It’s important that we have this registry enabled for our work and 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 -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat