Headless Raspberry Pi RAM Memory Tweak

raspberry_pi_logoIf you have created any sort of file or media server with your Raspberry Pi, chances are you do not need it to be connected to a monitor or external display of any sort. In my upcoming ultimate Raspberry Pi Media Server Guide i will assume headlessness and therefore we will be freeing more of its precious RAM. The Raspberry Pi only has 512 MB of DDR2 RAM which means every megabyte is valuable and must not be wasted. By default the Raspbian configuration uses 64MB of RAM for the GPU so it can output to an external display. Thanks to a firmware update we can reduce this number to 16MB so we get 48 more megabytes of precious RAM for the Raspberry Pi to do useful things with like searching for movies, downloading TV shows or serving up your media or files across your home network. This works on the B+ and Raspberry Pi 2, I don't have the older models to test it on but I imagine it will work on the model A and B as well.

If you are trying to figure out which hardware would work best for you, consider reading the Pi benchmarks.

Pi Unit
Processor
RAM
RAM Bus
Network
WiFi
USB
SATA
Cost
Raspberry Pi 3
1.2 GHz ARMv8
Quad Core
1 GB DDR2
450 MHz
100 Mbit
Yes
4
No
$35
Raspberry Pi 2
900 MHz ARMv7
Quad Core
1 GB DDR2
450 MHz
100 Mbit
No
4
No
$35.00
Raspberry Pi
700 MHz ARMv6
Single Core
512 MB SDRAM
400 MHz
100 Mbit
No
4
No
$25
Banana Pi
1 GHz ARMv7
Dual Core
1 GB DDR3
432 MHz
Gigabit
No
2
Yes
$36.99
Banana Pi Pro
1 GHz ARMv7
Dual Core
1 GB DDR3
432 MHz
Gigabit
Yes
2
Yes
$45.00

Raspberry Pi RAM Memory Tweak for all Models

Look at how much free memory is available

free -m

You will see some output like this, the total memory is 437 MB, free memory is 405 MB

             total       used       free     shared    buffers     cached
Mem:           437         74        363          0         13         28
-/+ buffers/cache:         32        405
Swap:           99          0         99

By default the Pi has 64 MB for the GPU, let's change it to 16MB

Update the Raspberry Pi firmware files with rpi-update which allows you to change the GPU RAM to 16 MB

sudo rpi-update

It will download some files and then tell you to reboot

raspberry pi firmware update

Time to reboot

sudo reboot

Then login again and run the configuration

sudo raspi-config

Go to option 8 – Advanced Options

raspberry pi 8 advanced options

Choose A3 Memory Split

raspberry pi A3 memory split

It says enter GPU Memory which is currently 64

Delete this and change it to 16 and press Enter

raspberry pi GPU 16MB memory change

You will be back at the configuration screen, press Tab and move to Finish

raspberry pi config finish

You will then need to reboot by pressing Enter

raspberry pi reboot now

When you log back in now you can check the free memory

free -m

Notice that the output has changed, total available memory is now 484 MB instead and free memory is now 452 MB

             total       used       free     shared    buffers     cached
Mem:           484         74        410          0         13         28
-/+ buffers/cache:         32        452
Swap:           99          0         99

I have increased the total available RAM memory from 437 MB to 484 MB and the free memory from 363 MB to 410 MB.

Now you have 48 MB of free RAM that your Raspberry Pi can now use do some more real work.