Reputation: 1110
I know this has been asked a lot on StackOverflow but I did not manage to get any solution to solve my problem.
My coworker assigned me on a new project. The application is hosted on test Debian server with git installed.
First I have created my branch :
git checkout -b mybranch
Then I have done small modifications to some files.
When I tried to push it to Github (using my github account)
git add myfile.php
git commit -m "my first commit"
git push origin mybranch
I get this error :
fatal: Out of memory, malloc failed
I don't understand what this mean. The total size of the files I tried to push is 156Ko. Moreover the total size of the project is only 10,9Mo.
I tried to reboot the server but the same happen.
When I run free
on the server I get :
total used free shared buffers cached
Mem: 505312 239532 265780 0 51576 71580
-/+ buffers/cache: 116376 388936
Swap: 0 0 0
My coworkers never had this problem before, even on the same test server.
Can someone highlight me on the reason of this error and a possible workaround?
Thanks in advance.
Upvotes: 4
Views: 1773
Reputation: 170
The reason for this COULD be a few large files in the repository.. Perhaps Zip Files, particularly if you have a plugin which backs up your code / database.
To check for these large files, cd into the root folder of your repository and run:
find . -size +10M -ls
This will surface the larger files.
At that point you may:
or if it important
*.zip binary -delta
This will make sure you're treating zip files as binary files - not tracking the changes made in them.
If that doesn't work, you may want to visit this answer here and try them out:
Git on Windows, "Out of memory - malloc failed"
Good luck!
Upvotes: 0
Reputation: 1
One other possibility for this problem, especially if you're provisioning a new server is to make sure you have a swapfile. This was my case with a new CentOS 6.7. You can try:
swapon -s
If there is no file then, if you're like me, that could be the solution (creating one). For CentOs you can follow https://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-swap-adding.html. And just google if you have another distro.
Upvotes: 0
Reputation: 328536
From the error message, it's not clear to me whether the error is on the local or the remote side.
Since it works for you coworker, the problem is probably on your computer. Maybe the Git repo is damaged. Try check it with git fsck
You can also clone the remote repo a second time as /tmp/test1
and then try git push /tmp/test1
. If this works, the problem is remote. If it fails, there is something wrong on your PC.
On your PC, check that you have enough memory free and how much memory a single process can request. On Linux, use ulimit -a
for this.
[EDIT] Also the output of free
suggests that you only have 256MB of free memory (you can verify with free -h
to more readable numbers). That's barely enough to run most programs today. Git needs a lot of memory to do its magic, so yes, you might actually have too little memory free.
Upvotes: 1