I'm configuring a new Rpi A+ with for headless processing. I'm currently running Pidora 2014. I have already minimized the GPU memory to 16 and switched to run level 3. After boot, I'm left with about 44Mb of RAM for my application.

What else can I do to maximize the RAM left for my application after all the services are started?

  • Note that pidora uses systemd, which fakes runlevels for backward compatibility with SysV init. fedoraproject.org/wiki/… Also, see my comments on framp's answer -- I think you actually have way more free RAM than you think. I have a B+ running pidora w/ the equivalent of "runlevel 3" and it only consumes ~30 MB after booting.
    – goldilocks
    Jan 8 '15 at 21:07

Linux and recent windows (7+?) Try to cache as much disk into ram as they can to speed things up a bit.

You can drop the caches then look at memory:

sync && echo 3 > /proc/sys/vm/drop_caches && free

gives me the output

             total       used       free     shared    buffers     cached
Mem:        234612      90632     143980          0      10284      27364
-/+ buffers/cache:      52984     181628
Swap:       102396       8692      93704

indicating I have 182 MB free (from 256 MB total). Not bad while running rtorrent, streaming an HD video via SMB, serving webpages, and reading weather sensors. I don't know what I would do on a headless box with the GB in the rpi2.

  • Note that dropping the cache is not necessary -- when that memory is actually needed, it will be made available -- but this may help you to understand what's going on.
    – goldilocks
    May 9 '15 at 14:50

I run two Pis in production at home: One as a NAS with SMB, NFS and DLNA The other as a seafile server

That's what is left when the server is up and running:

pi@raspifix ~ $ free
             total       used       free     shared    buffers     cached
Mem:        496592     430080      66512          0     112996     230412
-/+ buffers/cache:      86672     409920
Swap:            0          0          0


pi@seafile ~ $ free
             total       used       free     shared    buffers     cached
Mem:        496592     484912      11680          0      13292     346204
-/+ buffers/cache:     125416     371176
Swap:       102396          8     102388

Both work fine and perform well. As you can see the seafile server has approx 371MB free (caching aside), which is more than the 44MB you reported in your case.

Don't worry about the free memory left. Linux is able to handle the free memory very efficient. Unless you have a serious amount of memory swapped you should be fine.

  • Here's the basic concept: en.m.wikipedia.org/wiki/Cache_(computing) When stuff read from disk into memory is no longer needed by an application, the kernel leaves it there anyway in case another application asks for it again -- this saves reading from disk again. Eventually, all or most free memory will be that stuff. But it can be overwritten when required because it is not actually in use (if requested again, it goes back into play as application memory).
    – goldilocks
    Jan 8 '15 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.