DEV Community

Carlos Saltos
Carlos Saltos

Posted on

How do you get total amount of RAM memory Linux has using Scala

What ?

A simple Scala program to get the total RAM on a Linux machine

Why ?

Because I want to check from SBT if there is enough total RAM memory to run certain compilation options and I would like to share with others

How ?

Just go to https://github.com/csaltos/mem-on-linux-scala/blob/main/MemOnLinux.scala and copy paste the code, you can use it as bytes or gigabytes or filter for other memory options like memory free or available memory.

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more