Create swap file in TorizonCore

In case an application requires a little bit more RAM than available (for a short time), a swap file could be useful.
Is there a way to this in TorizonCore?

Greetings @vix,

I assume of course that the application will run in a container yes?

If yes then there are options when running a container that can control/allow how much swap memory a container can use: Runtime options with Memory, CPUs, and GPUs | Docker Docs

Particularly looking at --memory-swap:

--memory-swap is a modifier flag that only has meaning if --memory is also set. Using swap allows the container to write excess memory requirements to disk when the container has exhausted all the RAM that is available to it. 

This sounds similar to what you’re asking. Would this suffice?

That said I haven’t personally used these options in Docker myself. So I can’t comment too much on their effectiveness or use.

Best Regards,

Hello @vix ,
Do you have any updates on this topic?

Best regards,

My colleague was able to setup swap file on Torizon OS, but the --memory-swap flag is not enough.
As far as I understood when he explained to me, a swap file must be created in Linux, then you can configure how much swap memory every container can use.

Hello @vix

What do you mean with “not enough” ?

Can you point us to the documentation that your colleague used?

Best regards,

Hi @vix ,

Please note that creating a swap file on a flash-based device (like eMMC) can lead to rapid flash degradation. Therefore, creating a swap file under such conditions is strongly discouraged.

Hi @alex.tx
thank you very much for your advice.
What do you mean with “rapid”?
What is the expected flash lifetime with and without a swap file (under “average” condition)?

Depending on your application and memory allocation requests, it could be a matter of months, weeks, or even days of continuous usage.