2

I'm trying to push my app to heroku using: git push heroku master the process runs fine for a little while then spits out all kinds of errors that I've never seen before and I can't find much help on google.

Here is the error log form console:

XXXXX-MacBook-XXXXXX xxxx$ git push heroku master
Counting objects: 7885, done.
Delta compression using up to 4 threads.
git(237,0xb0185000) malloc: *** mmap(size=81125376) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
warning: suboptimal pack - out of memory
git(237,0xb0185000) malloc: *** mmap(size=93798400) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
git(237,0xb0185000) malloc: *** mmap(size=93798400) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
fatal: Out of memory, malloc failed (tried to allocate 93797389 bytes)
error: pack-objects died with strange error
error: failed to push some refs to '[email protected]:xxxxx-xxx-xx.git'

Anyone know what this all means and why it's happening?

Also, i noticed that my: /Users/xxxxxx/Sites/xxxxxx/.git/objects folder is 700+ megs, not sure if that's normal or not as I'm new to rails and github.

Thank you for any help.

19
  • 1
    Have you recently committed an enormous file (maybe by accident)? That is pretty huge for a .git directory; I wouldn't expect to see that unless the tracked content is in the hundreds of MB, with a significant amount of history. Commented Nov 17, 2010 at 5:16
  • 1
    The directory you mention is the one that holds the entire content of the repository. It's not tracked by the repo, it's how the repo stores data. I'd definitely suggest looking for large files (not in the .git directory). If git push is trying to grab 80-90MB of memory, that's a good sign you have some pretty large objects. Commented Nov 17, 2010 at 5:22
  • 1
    I don't know what's available on a mac for sure, but hopefully you could just do find . -size +10M from the top level to find files with sizes at least 10MB. Another possibility: do you have binary files that change frequently? Commented Nov 17, 2010 at 5:25
  • 1
    Wow. Sounds like you've had some very unusual history. What happens if you run git gc? Or... have you had this failure several times? I wonder if there are a bunch of partially constructed packfiles left behind by aborted pushes? They might be under easily identifiable temp filenames, not sure. Commented Nov 17, 2010 at 5:27
  • 1
    If you want to move this over to chat, it might be a bit easier to keep up with. I'll be keeping an eye on the git room for a little while. Commented Nov 17, 2010 at 5:50

3 Answers 3

3

Most of the problem-solving is in the comments above; by the time we moved over to chat, things were pretty much taken care of. Here's an answer, just to help close out the question.

It seems that there was some unknown problem in the repository causing the objects directory to grow out of control. We didn't really need to determine what this was, because all of the commits had already been pushed to the github repository. Simply recloning from there (hooray for DVCS providing free backups) created a perfectly good repository to replace the old one.

Moral of the story: If your .git directory is 20 times the size of your content, and it causes malloc/mmap failures during routine operations, something's probably wrong with your repo.

Sign up to request clarification or add additional context in comments.

1 Comment

@matt ryan: like I said, recloning from the remote repo, which contained all necessary information.
0

short answer: before doing git push heroku master, run git repack -a -d --window-memory=200m

why? from what I understand, git push runs git gc, which runs git repack.

the problem is that if no maximum memory size is passed, then git will take up unlimited amount of memory (aka all of the memory in your computer) when compressing..hence the out of memory error.

so before doing git push heroku master, run git repack -a -d --window-memory=200m

this will use a maximum of 200MB of memory when compressing, hence preventing the process running out of memory.

see http://linux.die.net/man/1/git-repack for more details.

Comments

0

Should be able to limit the packsize to 100mb and limit the thread number to 1:

$ git config --global pack.packSizeLimit "100m"

$ git config --global pack.threads "1"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.