title: Git GUI crashes every time it opens a repository
body: <p>Since few days ago, every time I start Git GUI in a repository, it displays this horrifying error message and quits after I click OK:</p>
  
  <pre><code>prepare-commit-msg hook failed:
  
        0 [main] us 0 init_cheap: VirtualAlloc pointer is null, Win32 error 487
  AllocationBase 0x0, BaseAddress 0x68560000, RegionSize 0x260000, State 0x10000
  C:\Program Files (x86)\Git\bin\sh.exe: *** Couldn't reserve space for cygwin's heap, Win32 error 0
  
  You must correct the above errors before committing.
  </code></pre>
  
  <p>It only happens with Git GUI and only when in repository (old or newly created one).  Common commands in Git Bash including commit work fine.</p>
  
  <p>Un-installing and re-installing with newer package (only minor version change) did not remove the issue.  It still happens with old repositories as well as with newly created ones.</p>
  
  <p>On a clean machine this issue does not reproduce, so I guess it's something on my box, but I don't remember installing anything funny.  I do remember turning off my box after a long time though, so maybe some Windows Update could have triggered this--that would also explain why the other machine does not suffer--it's 2-3 months since last Win update there.</p>
  
  <p>Any ideas how to shed light into this? (As I can only see it on single machine, I don't feel like submitting it to official tracker before I know it's not my/other app's fault...)</p>
  
  <hr>
  
  <p><strong>Update</strong> after first comments:</p>
  
  <ul>
  <li><blockquote>
    <p>If you remove or rename the hook script, does it work?</p>
  </blockquote>
  
  <p>Funny enough, but the hook script actually does not exist at all (no hook scripts are
  present--there are only *.sample files in .git\hooks).  Not even elsewhere (git program
  dir, etc.)</p></li>
  <li><blockquote>
    <p>Trace it so you know what commands it ran - from git-bash run <code>git gui --trace</code></p>
  </blockquote>
  
  <p>Sadly this does not output anything to the shell.  Behaviour is the same.</p></li>
  <li><blockquote>
    <p>Maybe get gdb in there.</p>
  </blockquote>
  
  <p>I tried but gdb did not output anything useful.  However, I don't have any experience
   with GDB, I'm probably doing it wrong.  I got a <a href="http://sourceforge.net/projects/mingw/files/" rel="noreferrer">MinGW's gdb</a>, ran it from command
   prompt with git.exe as argument and then ran <code>run gui</code>. gdb did not output anything
   interesting:</p>
  
  <pre><code>(gdb) run gui
  Starting program: C:\Program Files (x86)\Git\bin\git.exe gu
  [New Thread 8264.0x1ce4]
  [New Thread 8264.0x394]
  [Inferior 1 (process 8264) exited with code 01]
  (gdb)  
  </code></pre>
  
  <p>But I'm almost sure I'm Doing It Wrong, so advice is more than welcome :)</p></li>
  <li><blockquote>
    <p>Make sure you don't have cygwin installed or at least that it is not present in your
    PATH at all</p>
  </blockquote>
  
  <p>I do have cygwin installed (as I always had, before git broke).  From Cygwin I only
  have in path some *.bat launchers and some *.dll files, but I have checked with
  ProcMon that it does not touch them and even if I remove them from the path I still get
  the same crash.</p></li>
  </ul>