# "Cannot allocate memory" when upgrading

**URL:** <https://meta.discourse.org/t/cannot-allocate-memory-when-upgrading/44029>\
**Category:** Self-hosting\
**Tags:** server-resources\
**Created:** [May 11, 2016, 4:23am UTC](https://meta.discourse.org/t/cannot-allocate-memory-when-upgrading/44029 "2016-05-11T04:23:42Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![skx](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@skx](https://meta.discourse.org/u/skx)\
**Post date:** [May 22, 2016, 4:15am UTC](https://meta.discourse.org/t/cannot-allocate-memory-when-upgrading/44029/8 "2016-05-22T04:15:33Z")

</div>

> [@prateekvarma](#):
>
> /usr/local/bin/ruby -r ./siteconf20160522-8243-1yibai4.rb extconf.rbCannot allocate memory - /usr/local/bin/ruby -r ./siteconf20160522-8243-1yibai4.rb extconf.rb 2\>&1

It looks like this is your problem:

> “Cannot allocate memory”

The solution here is to stop apache, stop mysql, stop all the services you can, temporarily, such that you have free RAM and can build the gems. Then post-build you can restart them.

Failing that if you’re on a virtual machine pay for more RAM.

---

_[View the full topic](https://meta.discourse.org/t/cannot-allocate-memory-when-upgrading/44029)._
