fatal: Out of memory, malloc failed (tried to allocate 2282218975 bytes)

I'm attempting "Check out in SourceTree" for a work project that is located in Stash and when the project tries to clone itself it is stopped by the error that is has run out of memory. I've never checked out this project before so this is my first time interacting with this repository on my machine. I'm not sure how to go about resolving my error so that I can get the large project to my machine.

12 answers

Can you give a little bit more information?

Is it a git project? If so, what git version are you using? What platform is your machine? Unix/Windows/32/64 Bit? How much memory do you have and how big is the repository?

BG Sebastian 

My employer uses most of the Atlassian products so Jira, Confluence, and Stash. From my understanding Stash uses git; we just use SourceTree (version 1.8.3 but it doesn't specify what version of git it is using in the About section) as a gui interface. I'm running a windows 7 machine with 32GB of RAM with 8 cores. The repository that I'm trying to get from the server is a little over 2GB.

Sorry, I've just read "SourceTree" which is able to use Git as well as hg/mercury. 

OK, very well - the next thing you need to find out (or maybe you know it already) if your installation is using the embedded GIT or the system git. Then you can increase the memory limit(s) for git or update if it's a known issue. You can also try to clone it from command line and post the output. 

Open Tools > Options > Git. see which button is disabled or post a screenshot (from: https://confluence.atlassian.com/sourcetreekb/using-embedded-git-or-system-git-in-sourcetree-785323587.html ).

You can now open a console and switch to the path where your git is located.

cd %USERPROFILE%\AppData\Local\Atlassian\SourceTree\git_local\bin

and increase memory for git by using the following commands

git config pack.packSizeLimit 1g
git config pack.deltaCacheSize 1g
git config pack.windowMemory 1g
git config core.packedGitLimit 1g
git config core.packedGitWindowSize 1g

or change the git config file

[pack]
        deltaCacheSize = 1g
        packSizeLimit = 1g
        windowMemory = 1g
[core]
        packedGitLimit = 1g
        packedGitWindowSize = 1g

Try increase these values carefully.

I can see that it is running the embedded version of git that came with SourceTree. The version of git it is using is 1.9.5. When I pasted your cd command into cmd it found the location but when I attempted to up the memory it said there was no config file. But when I did a dir of the directory I was in, it found it in the etc folder. Below are the contents of the file. Do you recommend applying the changes you suggested to this file?

[core]
    symlinks = false
    autocrlf = true
    longpaths = true
[color]
    diff = auto
    status = auto
    branch = auto
    interactive = true
[pack]
    packSizeLimit = 2g
[help]
    format = html
[http]
    sslCAInfo = C:/Users/smithmelan/Documents/NetBeansProjects/salt-stash.saicwebhost.crt
    sslverify = true
[sendemail]
    smtpserver = /bin/msmtp.exe
[diff "astextplain"]
    textconv = astextplain
[rebase]
    autosquash = true

Yes, try increase packSizeLimit to 4g.

Did this worked out for you? 

I'm sorry I was unable to write back yesterday because I have 0 points and that limits my activity to 2 posts per day. Below is my gitconfig file and the values I changed to 3g. I was unable to increase the packSizeLimit to 4g without receiving an error that 4g is out of range.

[core]
    symlinks = false
    autocrlf = true
    longpaths = true
    packedGitLimit = 3g
    packedGitWindowSize = 3g
[color]
    diff = auto
    status = auto
    branch = auto
    interactive = true
[pack]
    packSizeLimit = 3g
    deltaCacheSize = 3g
    windowMemory = 3g
[help]
    format = html
[http]
    sslCAInfo = C:/Users/smithmelan/Documents/NetBeansProjects/salt-stash.saicwebhost.crt
    sslverify = true
[sendemail]
    smtpserver = /bin/msmtp.exe
[diff "astextplain"]
    textconv = astextplain
[rebase]
    autosquash = true

I remember that there is a limit on windows depending on the build/gcc version. The max value then is 4095m. Did you try to clone the project again with the new values? Did it work?

Unfortunately, no it did not. I've attempted to clone via the SourceTree interface and the terminal. Is my project that I'm trying to retrieve just too large for what my machine can handle to checkout?

image2016-8-3 8:26:53.png

I have a co-worker who is running on the same environment who did not have issues getting the project. I asked to see her gitconfig file and she doesn't have any of the configs that mine has.
image2016-8-3 8:29:55.png

 

Also, that may be the last comment I can post today due to the constraint of having 0 points.

 

You should now be able to answer wink. It might be, that there are large binary files inside the repo. Copy your co-workes gitignore_global.txt to your machine and add the excludesfile entry to your gitconfig. 

Also while you try the next time, monitor your memory usage in task manager to identify if your machine is running out of memory or if malloc just refuses to allocate such a big block of memory. 

 

Thanks for that! I do think I am running out of memory from just checking the task manager like you said. I started with ~1800MB free and about 5-7 minutes into the clone I got my error and the free memory was <500. It stayed pretty constant between 11GB-10GB memory usage.

Another co-worker wanted to know if I was running 32 or 64 bit version of git and since I'm using the embedded version which comes with the 32 bit version of SourceTree I'd assume that it's also a 32 bit git. So I installed the latest release of the 64bit git. Unfortunately, when I open git-bash it's starts spiting out process and child processes saying that it died waiting for dll loading.

I'm not entirely sure what caused me to be able to clone, but using SourceTree and not the command line got me a full 100% clone. Towards the end of the checkout it did output the same errors I saw in the terminal, but it did get me the project.

image2016-8-3 13:29:47.png

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

709 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot