git out of memory on checkout

会有一股神秘感。 提交于 2019-12-05 01:28:54

I encountered the same annoying problem after my server was updated to 64Bit architecture. The OS memory limit for git was at 600m.

core.preloadIndex = false

finally did the trick for me. It defaults to true since git version 2.1

I got this error message: "Fatal: Out of memory, realloc failed2 " when trying to use git add --all. The reason is that I attempted to add a very large csv file (>1.6 GB). Git/Github does not allow to upload such a large file. As a solution you can put the file on gitignore or move the file to another directory not connected to git.

Nhysi

Try this:

git gc --auto --prune=today --aggressive 
git repack 
git config --global http.postbuffer 524288000 
git config --global pack.windowMemory 256m

Found on git push Out of memory, malloc failed.

Set the following parameters to fix this issue:

core.packedGitWindowSize

Number of bytes of a pack file to map into memory in a single mapping operation. Larger window sizes may allow your system to process a smaller number of large pack files more quickly. Smaller window sizes will negatively affect performance due to increased calls to the operating system’s memory manager, but may improve performance when accessing a large number of large pack files.

Default is 1 MiB if NO_MMAP was set at compile time, otherwise 32 MiB on 32 bit platforms and 1 GiB on 64 bit platforms.
This should be reasonable for all users/operating systems. You probably do not need to adjust this value.

core.packedGitLimit

Maximum number of bytes to map simultaneously into memory from pack files.
If Git needs to access more than this many bytes at once to complete an operation it will unmap existing regions to reclaim virtual address space within the process.

Default is 256 MiB on 32 bit platforms and 8 GiB on 64 bit platforms.
This should be reasonable for all users/operating systems, except on the largest projects.
You probably do not need to adjust this value.


But sometimes you do need to set those values

Here is a complete list of config values which i can think of and can be relevant to your case :

[http]
    postbuffer = 524288000
[pack]
    threads = 1
    deltaCacheSize = 1024m
    packSizeLimit = 1024m
    windowMemory = 1024m
[core]
    packedGitLimit = 1024m
    packedGitWindowSize = 1024m
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!