Raspberry Pi

How to Measure Memory Usage on Raspberry Pi

If you are a Raspberry Pi user then you might be aware that Raspberry Pi does not have its own storage. It uses external storage (such as USB, SD card, or an SSD), and even the operating system of Raspberry Pi is installed on the external storage due to which it is not possible to keep changing memory devices for storage. So, it is always better to measure the Raspberry Pi memory usage. This guide will help you to measure the memory on Raspberry Pi.

How to Measure Memory Usage on Raspberry Pi

There are multiple commands to measure the memory usage of Raspberry Pi and we will discuss each of them in this article:

1: Measuring the Total Memory

If you want to check the complete memory status of the Raspberry Pi system then use the below-mentioned command:

$ cat /proc/meminfo | less

This command will display the results of the total memory and the available space in Raspberry Pi.

2: Measuring the RAM

The maximum RAM size available for Raspberry Pi is 8GB RAM. It is responsible for the performance of the Raspberry Pi system. If the load on RAM increases the overall performance of the Raspberry Pi system gets slow. So, to avoid such a situation keep a check on the RAM memory, and to check follow the below-mentioned command:

$ free -h

The output of the above command will display the stats of RAM memory by displaying the total, used, and available space on RAM.

3: Measuring the SD Card Memory

To measure the memory available on the external storage device such as SD card use the below-written command:

$ sudo fdisk -l

The output will display the list of all external storage devices along with their memory measurement in terms of size and sectors:

If the above output is difficult to read or understand for any user then there is another command also that can be used to display memory information of SD card in a human-readable form which is mentioned below:

$ df -h

The -h flag in the command is used for human readable form and the output will display memory measurements in KBs, MBs or GBs which are easily understandable for anyone:

How to Resolve Exceeded Memory Issues in Raspberry Pi

For mini computers, memory is always a major issue and it is really important to keep a proper check on memory else the performance of the overall system could get affected. To avoid exceeded memory use on Raspberry Pi follow the tips below:

  • Avoid installing heavy applications or software as this puts a lot of loads on the system.
  • Before installing any new package make sure you know how much disk space it will acquire.
  • Keep checking memory regularly to be on the safer side.
  • Uninstall/Remove all the unnecessary packages that are not required any longer. For guidance follow the

To increase your Raspberry Pi’s memory, read this guide.

Conclusion

For all small computing devices memory remains a major concern, so it is very important to measure the memory of the system before any new installation or even if the system’s performance is slowed down. To measure the memory usage on Raspberry Pi we have shared different methods in the article.

About the author

Zahra Zamir

An Electronics graduate who loves to learn and share the knowledge, my passion for my field has helped me grasp complex electronics concepts and now I am here to share them with others.