Is it possible to setup swap on resin.io / ResinOS?

I’m running a Raspberry Pi 3 with a WPE based signage solution, where my users can set up a series of screens that run as a slideshow. Each screen is a webpage that loads via AJAX and is injected into the document.

I have experienced that if my RPi ever runs out of memory the system reboots. This in itself is fine, as it is exactly what I’d like it to do, and with the way my test is currently set up it takes about 10-12 hours before it reaches 1GB of memory (showing a ton of gifs, HTML5 videos and flash content).

But, since I have no control over what my users put on the screen and it might be much more memory intensive than my test setup (and include memory leaks from iframes and embedded content), I’d like to extend the amount of time the screen can run before it needs to restart.

I was hoping setting up a swapfile might help, but I don’t seem to be able to since the FS is read-only.

I’m also wondering if it’s possible to setup a swapfile (or otherwise increase the memory limit).

I have a container that may run out of memory when compiling some larger projects during development in local mode.

I haven’t tried this yet, but it looks related: Create a swap file

I have this in my dockerfile. I believe I got it from the Screenly OSE edition. It creates a temporary file storage facility

# By default docker gives us 64MB of shared memory size but to display heavy
# pages we need more.
umount /dev/shm && mount -t tmpfs shm /dev/shm

My use case may be a little different, so I figured I should clarify :slight_smile:

I’m running out of memory while performing a build on a device in local mode via:

balena push <device-ip>

I’m hoping to avoid running out of memory by using a swapfile (or other ideas) during the build phase.

@eCustic Hey there! Setting a swap file mitigates the problem but I don’t think its an actual solution, plus it’d make your app really slow.

It sounds like you should be able to tweak your application so it only stores a maximum amount of content at any given time. For example, the signage app can only reserve enough memory to serve the current slide.

and with the way my test is currently set up it takes about 10-12 hours before it reaches 1GB of memory (showing a ton of gifs, HTML5 videos and flash content).

Can you explain in more detail what your test does? If the device keeps consuming memory over time, then its probably a memory leak?

Hey @wlisac ,

Do you mind opening a new thread so we can help you out with that? :slight_smile:

@jviotti no problem :slight_smile: Running out of memory during build via balena local push