[FATAL] failed to allocate memory

I got this error today on my iMac. It was incredibly frustrating and I tried all of the following to fix it (the reason I list them is because I’m not entirely sure the final step I’ll mention at the end was the sole solution).

1. uninstall mysql2 gem (gem uninstall mysql2)
2. uninstall mysql on homebrew (brew uninstall mysql)
3. uninstall mysql-connector-c on homebrew (brew uninstall mysql-connector-c)
4. reinstall mysql on homebrew (brew install mysql)
5. reinstall mysql-connector-c on homebrew (brew install mysql-connector-c)
6. reinstall mysql2 gem (gem install mysql2)

After all that I still got the error… at this point I was about to set my hair on fire, but then I noticed I had receieved a difference error message in my logs…

ActionView::Template::Error (dyld: Library not loaded: /opt/local/lib/libssl.1.0.0.dylib
Referenced from: /usr/local/bin/node
Reason: image not found

Do you see that reference to node? WTF!

So then I did the following:

1. uninstall node on homebrew (brew uninstall node)
2. reinstall node on homebrew (brew install node)

WOOHOO! It worked again! My hair is safe and I can stand down from Defcon 1. Why did this happen? I have no idea. Hopefully this helps someone else and please let me know in the comments if you know why this happened.


  1. says

    When I saw this blog post, and saw that it was from yesterday, and then saw that you had a problem with node, which I actually installed yesterday, I burst into happiness …

    Only to realize, that the problem still persists, even after I did all that you suggested. The problem is, I don't even get any error message, it just crashes on me when booting the app, so I'm not even sure if it is the same issue.

    $ bundle exec rails server=> Booting WEBrick=> Rails 3.1.1 application starting in development on> Call with -d to detach=> Ctrl-C to shutdown server[FATAL] failed to allocate memory
    Are there any other things you forgot to mention in this post?

    • says

      Yup that's the same issue. I spent at least an hour troubleshooting MySql because I got it doing a db:migrate, but then I realized it happened with any command that basically boots Rails.
      The only thing I can think of is I did uninstall and reinstall the rails gem 'after' I did these steps… And I didn't mention it, but I also stop and started MySql after reinstalling it – to make sure I was running the new installation.
      Hope that's helpful.

      • says

        Looks like the issue was that I compiled ruby with different GCC than the gem itself. Because I have both Xcode 4.2 and GCC 4.2 installed, when I installed Ruby I used the llvm-gcc compiler, which seemed to work just fine, until something changed and I probably started compiling all gems with gcc-4.2 …

        I basically recompiled whole ruby and mysql2 explicitly with gcc-4.2 and the issue disappeared.

Leave a Reply

Your email address will not be published. Required fields are marked *