nicknml
Posts: 200
Joined: Thu Mar 15, 2012 8:44 pm

Any ways to further minimize RAM usage?

Sun Aug 26, 2012 4:19 pm

Are there any other services that I can disable to cut down RAM usage? Right now I don't have anything else running besides the default services that are running and I'm at 54MB of RAM used (before a few updates yesterday, RAM usage was normally around 47M). Will be interesting to see how low I can get.

User avatar
PeterO
Posts: 4882
Joined: Sun Jul 22, 2012 4:14 pm

Re: Any ways to further minimize RAM usage?

Sun Aug 26, 2012 4:24 pm

How are you calculating the figure of "54M" ? Linux uses memory in several ways.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

nicknml
Posts: 200
Joined: Thu Mar 15, 2012 8:44 pm

Re: Any ways to further minimize RAM usage?

Sun Aug 26, 2012 4:25 pm

PeterO wrote:How are you calculating the figure of "54M" ? Linux uses memory in several ways.

PeterO
Using the used figure reported by top.

User avatar
PeterO
Posts: 4882
Joined: Sun Jul 22, 2012 4:14 pm

Re: Any ways to further minimize RAM usage?

Sun Aug 26, 2012 4:35 pm

Which figure reported by top though ?

Unless you have something in mind which will use all of the ram then you are really wasting you time with this. Let the kernel look after the memory management, it's much better at it than you'll be ! :roll:
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

nicknml
Posts: 200
Joined: Thu Mar 15, 2012 8:44 pm

Re: Any ways to further minimize RAM usage?

Sun Aug 26, 2012 4:38 pm

The used figure under KiB Mem.

nicknml
Posts: 200
Joined: Thu Mar 15, 2012 8:44 pm

Re: Any ways to further minimize RAM usage?

Sun Aug 26, 2012 8:45 pm

Didn't realize that the "used" statistic included buffers and cached, so actual memory usage is actually 15M (yea, I don't think I can get much lower than that ;) )

User avatar
mpthompson
Posts: 620
Joined: Fri Feb 03, 2012 7:18 pm
Location: San Carlos, CA
Contact: Website

Re: Any ways to further minimize RAM usage?

Mon Aug 27, 2012 4:31 am

Yeah, gotta watch out for the memory buffers/cache as the OS discards them if more memory is needed so they really don't count against the memory being used.

A few additional commands you might find useful for tracking memory:

Code: Select all

free -h
and

Code: Select all

cat /proc/meminfo

Lartza
Posts: 3
Joined: Thu Jul 05, 2012 8:19 am

Re: Any ways to further minimize RAM usage?

Mon Aug 27, 2012 10:00 pm

nicknml wrote:Didn't realize that the "used" statistic included buffers and cached, so actual memory usage is actually 15M (yea, I don't think I can get much lower than that ;) )
That's not true! :)

Switch openssh to dropbear and /bin/sh to dash from bash.
Disable extra tty's and disable ipv6(might not actually reduce memory usage).
Switch rsyslogd to inetutils-syslogd and disable ntpd (run ntpdate on boot and with cron)
Disable DHCP, set a static IP.

You can probably do still a little more, but not much. I am currently using around 10MB, 1MB more if I log in on a tty and not SSH (for some reason)
(If anyone can think of something else let me know :P)

headhoncho
Posts: 7
Joined: Tue Sep 11, 2012 3:13 am
Location: New York

Re: Any ways to further minimize RAM usage?

Thu Sep 13, 2012 1:53 am

some additional stuff i found on reducing RAM use

http://extremeshok.com/blog/debian/rasp ... ory-usage/

User avatar
jojopi
Posts: 3078
Joined: Tue Oct 11, 2011 8:38 pm

Re: Any ways to further minimize RAM usage?

Thu Sep 13, 2012 4:48 am

Lartza wrote:Switch openssh to dropbear and /bin/sh to dash from bash.
In recent debian, /bin/sh is already dash. But that will not save you much after boot, if your login shell is explicitly bash. Assuming you meant to change login shell to dash, I think you will find that pdksh is considerably smaller still:

Code: Select all

$ for i in bash "busybox sh" dash ksh pdksh zsh; do $i -c '/bin/ps uw $$ && :'; done |sort -unk5
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
pi        4090  0.0  0.0    424   236 pts/0    S+   05:30   0:00 pdksh -c /bin/ps uw $$ && :
pi        4086  0.0  0.2   1744   508 pts/0    S+   05:30   0:00 dash -c /bin/ps uw $$ && :
pi        4084  0.0  0.2   2300   548 pts/0    S+   05:30   0:00 busybox sh -c /bin/ps uw $$ && :
pi        4082  0.0  0.5   4804  1236 pts/0    S+   05:30   0:00 bash -c /bin/ps uw $$ && :
pi        4092  0.0  0.5   5544  1408 pts/0    S+   05:30   0:00 zsh -c /bin/ps uw $$ && :
pi        4088  0.0  0.5   5548  1264 pts/0    S+   05:30   0:00 ksh -c /bin/ps uw $$ && :
Though personally I would not sacrifice interactive usability features like bash's tab completion, just to have 0.5% more memory not being used.

Return to “Raspbian”