Limiting VM memory

I’m trying to run on an embedded device and would like the vm to only have 64 MB. I tried setting the following vm args:

-MMscs 64 -MMsco true -MMscrpm true -Musac false

I still seem to be using 103 MB according to top. What is the best way to keep the VM under a specific limit.

2 Likes

Aren’t those emulator flags and as such need a plus instead of a minus?

1 Like

I use a plus in the arguments, but those get changed to - when it starts beam. I copied those from top which is why they have - here.

1 Like

Okay, I took a look at the documentation of the flags you use.

Those only affect one of the 13 allocators described in http://erlang.org/doc/man/erts_alloc.html.

I do not think that there is a way to simulate limited RAM as you want it via arguments to the ERTS.

I think you have to use ulimit or cgroups memory control.

I’m not sure though, if they will set an upper bound to your process or if they will simply kill you after reaching the threshold.

3 Likes