git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Christopher Faylor <me@cgf.cx>
To: git@vger.kernel.org
Subject: Re: Cygwin can't handle huge packfiles?
Date: Wed, 5 Apr 2006 20:34:50 -0400	[thread overview]
Message-ID: <20060406003449.GA7174@trixie.casa.cgf.cx> (raw)
In-Reply-To: <20060405232739.GA18121@nospam.com>

On Thu, Apr 06, 2006 at 01:27:39AM +0200, Rutger Nijlunsing wrote:
>On Wed, Apr 05, 2006 at 05:08:44PM -0400, Christopher Faylor wrote:
>> On Wed, Apr 05, 2006 at 04:14:20PM +0200, Johannes Schindelin wrote:
>> >> Inspired by a patch of Alex Riesen (thanks, Alex), I tried to use the
>> >> regular mmap for mapping pack files, only to discover that I compile
>> >> without defining "NO_MMAP", so I've been using the stock mmap all
>> >> along. So now I'm thinking that the cygwin mmap also does a
>> >> malloc-and-read, just like git does with NO_MMAP. So I'll continue to
>> >> investigate in that direction.
>> >
>> >I think cygwin's mmap() is based on the Win32 API equivalent, which could 
>> >mean that it *is* memory mapped, but in a special area (which is smaller 
>> >than 1.5 gigabyte). In this case, it would make sense to limit the pack 
>> >size, thereby having several packs, and mmap() them as they are needed.
>> 
>> Yes, cygwin's mmap uses CreateFileMapping and MapViewOfFile.  IIRC,
>> Windows might have a 2G limitation lurking under the hood somewhere but
>> I think that might be tweakable with some registry setting.
>
>Windows places its DLLs criss-cross through the memory space because
>every DLL on the system has its own preferred place to be loaded (the
>base address). This severely limits the amount of largest contiguous
>memory block available, which is needed for one mmap() I think.
>
>Several solutions exist:
>  - enlarge the address space with the /3GB boot flag in boot.ini

Thanks.  The 3GB boot flag is what I was trying to remember.

>  - rebase all DLLs with REBASE.EXE (part of platform sdk) .
>    Just make them the same and fix them to a low address.
>    Problem is rebasing system dlls since those are locked by the system.

Cygwin has its own version of rebase and a method for rebasing all of the
dlls in the distribution.  Using that may help squeeze out a little bit
of memory.

>  - at start of program before other DLLs are loaded,
>    reserve an as large part of the memory as possible with
>    VirtualAlloc()

Cygwin actually uses this trick to try to push DLLs into their right
locations after a fork.  It sort of works but sometimes, in a child
proccess, Windows puts "stuff" in locations previously occupied by a
DLL.  I could swear that it does that just to be annoying...

There is a chicken/egg problem here in that Cygwin uses Doug Lea's malloc
and that version of malloc will use mmap when sbrk() fails -- as it is
apt to do when allocating gigabytes of memory.  So, using malloc is
not a way to avoid mmap.

cgf

  reply	other threads:[~2006-04-06  0:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-03  9:46 Cygwin can't handle huge packfiles? Kees-Jan Dijkzeul
2006-04-03 13:23 ` Johannes Schindelin
2006-04-03 14:26   ` Morten Welinder
2006-04-03 14:33   ` Linus Torvalds
2006-04-03 14:36     ` Linus Torvalds
2006-04-05 13:24       ` Kees-Jan Dijkzeul
2006-04-05 14:14         ` Johannes Schindelin
2006-04-05 21:08           ` Christopher Faylor
2006-04-05 23:27             ` Rutger Nijlunsing
2006-04-06  0:34               ` Christopher Faylor [this message]
2006-04-06  4:13         ` Junio C Hamano
2006-04-07  8:15       ` Junio C Hamano
2006-04-07  8:27         ` Jakub Narebski
2006-04-07 14:11         ` Nicolas Pitre
2006-04-07 18:31           ` Junio C Hamano
2006-04-07 18:46             ` Nicolas Pitre
2006-04-03 15:12     ` Johannes Schindelin
2006-04-03 14:38 ` Alex Riesen
  -- strict thread matches above, loose matches on Subject: below --
2006-04-06 20:57 linux
2006-04-06 23:53 ` Junio C Hamano
2006-04-07  3:05   ` linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060406003449.GA7174@trixie.casa.cgf.cx \
    --to=me@cgf.cx \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).