# Ember-cli build memory usage risks failure (OOM) on minimum instance size

**URL:** <https://meta.discourse.org/t/ember-cli-build-memory-usage-risks-failure-oom-on-minimum-instance-size/245547>\
**Category:** Self-hosting\
**Tags:** server-resources\
**Created:** [November 14, 2022, 5:35pm UTC](https://meta.discourse.org/t/ember-cli-build-memory-usage-risks-failure-oom-on-minimum-instance-size/245547 "2022-11-14T17:35:24Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)\
**Post date:** [November 15, 2022, 9:43pm UTC](https://meta.discourse.org/t/ember-cli-build-memory-usage-risks-failure-oom-on-minimum-instance-size/245547/5 "2022-11-15T21:43:59Z")

</div>

> [@Ed\_S](#):
>
> Looks like we explicitly increased node’s allowable heap from 500M to 2G - possibly this is a step too far, and 1.5G would be better:

The reason we added that flag was that Node’s own OOM killer was killing the build - 500M wasn’t enough. Happy to try tweaking it to 1.5G - I just tried it on my droplet and it seems to work ok. In fact, it seems even 1.0G is enough.

I tried tracking the memory usage with different max\_heap sizes:

```plaintext
(while(true); do (free -m -t | grep Total | awk '{print $3}') && sleep 0.5; done) | tee 1000mb.csv

```

Shows this usage during the build:

 ![Memory Usage during Build](https://global.discourse-cdn.com/meta/original/4X/e/a/1/ea1abaf91cdc5e4b66673bfedd6b68f4d225084a.png)

There was very little difference in build time, but the 1GB and 1.5GB limits clearly produce less overall usage. As expected, the `time` output shows significantly fewer “Major page faults” when the node limit is lower.

It’s curious that the difference between 1.5GB and 1GB is so small… 🧐

In any case, I agree decreasing the limit is a good idea. To make sure it doesn’t affect the build performance on higher-spec machines, I think we should only override the limit when we know it’s too low. Otherwise, we can let Node use its default.

Here’s a PR - we’ll try and get this merged soon. Thanks for raising this @Ed_S!

[https://github.com/discourse/discourse/pull/19040](https://github.com/discourse/discourse/pull/19040)

---

_[View the full topic](https://meta.discourse.org/t/ember-cli-build-memory-usage-risks-failure-oom-on-minimum-instance-size/245547)._
