msys git – error could not allocate cygwin heap

I am using TortoiseGit on Windows for a while now, and it works OK. However, today, it just stopped working. The error I got persistently was:

0 [main] us 0 init_cheap: VirtualAlloc pointer is null, 
Win32 error 487 AllocationBase 0x0, BaseAddress 0x68540000, 
RegionSize 0x480000, State 0x10000 
c:\msysgit\bin\sh.exe: 
*** Couldn't reserve space for cygwin's heap, Win32 error 0

More than mildly annoying.

I tried searching the web, and found a number of discussions on similar issues. It was not easy to find one that worked, but in the end it turns out that playing with the base address of the msys-1.0.dll file worked. The error is not really in TortoiseGit per se, but rather in msysgit (which tortoisegit relies on to actually do its work).

The magic incantation that I wound up using:

c:\msysgit\bin>rebase.exe -b 0x50000000 msys-1.0.dll

Posting it here for the benefit of any other poor soul who is hit by the same. Apparently, you might have to change to use different other addresses.

The details of my setup for reference:

  • msysgit 1.7.4
  • tortoisegit 1.6.5.0
  • Windows 7, 64-bit

 

25 thoughts on “msys git – error could not allocate cygwin heap”

  1. And it might be worth noting that rebase.exe has absolutely nothing to do with “git rebase”. ๐Ÿ™‚

  2. Yes. rebase.exe is a Windows tool that changes the load address of DLLs as I understand it.

  3. It would have been interesting to check the date of last modification on the msys-1.0.dll prior to rebase.
    Why did it work before and all of a sudden error?

  4. bugnificient :It would have been interesting to check the date of last modification on the msys-1.0.dll prior to rebase.
    Why did it work before and all of a sudden error?

    If I knew why I would have fixed it ๐Ÿ™‚
    I suspect some arbitrary Microsoft Windows update, or the anti-virus, or anything else that changes load addresses of other DLLs. Fundamentally, it looks like a limitation in cygwin.

  5. I’m having the same issue now while performing a git rebase using the latest 1.7.6.msysgit.0 with SmartGit. I already had this problem in the past and could solve it by rebooting Windows.

  6. Pingback: git ?? | GPD
  7. Score another one for you. Thanks big time.
    For me, this happened immediately following a TortoiseGit update today.

  8. With later Visual Studio (VS2015) you can do it this way (don’t seem to have rebase.exe around)

    “C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\editbin” /rebase:base=0x50000000 msys-1.0.dll

    But the basic solution is still working.

  9. Wonderful Staff here,
    A simple Reboot helped me a lot, Thanks Mike Lehmann

  10. Gys I am working with Eclipse SDK and I didn’t find (rebase.exe) in bin,
    Is there is any way I can download it ??? win64

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.