Executing git generates couldn't reserve space for cygwin's heap
After pushing to Stash results in the following intermittent error on Git clients:
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
The full explanation for such issue can be found on this Stackoverflow answer.
It's Cygwin code failing to allocate a ~5 MB large chunk of memory for its heap at this fixed address 0x68570000, while only a hole ~2.5 MB large was apparently available there. The relevant code can be seen in msysgit source.
Both current Cygwin and the new version of MSYS - MSYS2 - already have different logic in place, which is hopefully more robust. It's only old versions of Git for Windows which have been still built using the old broken MSYS system.
- Install Git for Windows 2 - it is built with the new, properly maintained MSYS2 and also has many new features, plenty of bug fixes and so on. There is also a 64-bit version available which would lower the chance of address space clashes considerably even if this problem was not fixed.
If you're using Embedded Git, you would need to change SourceTree's Git Setting to Use System Git by navigating to Tools>Options>Git(Tab)>Git Version>Use System Git
- On our Supported Platforms we outline the Git versions that should work well with your environment.