记cmder/git一个报错解决

记cmder/git一个报错解决

Couldn’t reserve space for cygwin’s heap, Win32 error 0

早上开机想试试adb工具,由于是在Windows机器,第一个想到的还是用cmder来命令行操作,然后不知道是昨天系统自动更新强制杀了昨天的cmder进程造成文件损坏还是什么鬼,ls直接报错(普通用户打开cmder就可以执行ls,用管理员打开,就不行),具体报错信息:

1
2
3
4
{lamb} ls
0 [main] us 0 init_cheap: VirtualAlloc pointer is null, Win32 error 487
AllocationBase 0x0, BaseAddress 0x68570000, RegionSize 0x450000, State 0x10000
D:\dev\cmder\vendor\msysgit\bin\ls.exe: *** Couldn't reserve space for cygwin's heap, Win32 error 0

同样的报错也可能出现在使用git时候:

1
2
3
4
5
C:\Program Files\Git\bin\git.exe pull --progress "origin" 
Done
0 [main] us 0 init_cheap: VirtualAlloc pointer is null, Win32 error 487
AllocationBase 0x0, BaseAddress 0x68560000, RegionSize 0x390000, State 0x10000
C:\Program Files\Git\bin\sh.exe: *** Couldn't reserve space for cygwin's heap, Win32 error 0

解决

重装cmder

首先以为是昨天系统自动升级时候强制杀了cmder进程造成文件损坏,就尝试重装了次,为了避免注册表问题,还选了其他的地址,安装完毕之后管理员打开cmder,ls还是报那个错,失败

rebase.exe -b

这个办法,原理不知道。。。在stackoverflow翻到的,不过是真解决了

  1. 首先是进路径\msysgit\bin查看是否有rebase.exe该程序

  2. 命令行进入路径\msysgit\bin目录,执行rebase.exe -b 0x50000000 msys-1.0.dll即可,正常情况下执行该命令没任何响应,重启cmder或者git即解决

Tips
  1. rebase.exe文件所在路径不固定,可能在路径\msysgit\bin下,也可能在C:\Program Files (x86)\Git\bin
  2. 在执行rebase之前,需要确保msys-1.0.dll不是运行状态,
    查看方法,启动命令行,执行tasklist /m msys-1.0.dll
  3. 养成好习惯,在执行rebase之前,先备份:copy msys-1.0.dll msys-1.0.dll.bak,如果执行失败ReBaseImage (msys-1.0.dll) failed with last error = 6
    考虑按以下步骤:
  • 把dll文件拷贝到其他的目录下
  • 重新复制生成备份文件
  • 用副本替换原文件
    另外,考虑用管理员身份运行

以上,完~

参考文章

初始解决:jakob
stackoverflow问题解决

文章目录
  1. Couldn’t reserve space for cygwin’s heap, Win32 error 0
  2. 解决
    1. 重装cmder
    2. rebase.exe -b
      1. Tips
  3. 参考文章
|