OpenWrt Forum Archive

Topic: free RAM memory on WL500Gp

The content of this topic has been archived on 25 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,
i'm triing to free some RAM memory from my WL500Gp with KAMIKAZE 7.09.
I know that /tmp filesystem use 50% of RAM memory. I've changes a /etc/preinit:

#!/bin/sh
# Copyright (C) 2006 OpenWrt.org
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
. /etc/diag.sh

failsafe_ip() {
        ifconfig $ifname 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255 up
}

failsafe() {
        [ -n "$ifname" ] && grep "$ifname" /proc/net/dev >/dev/null && {
                failsafe_ip
                netmsg 192.168.1.255 "Entering Failsafe!"
                telnetd -l /bin/login <> /dev/null 2>&1
        }
        lock /tmp/.failsafe
        ash --login
}

mount none /proc -t proc
mount none /sys  -t sysfs

size=$(awk '/MemTotal:/ {l=5242880;mt=($2*1024);print((s=mt/2)<l)?mt-l:s}' /proc/meminfo)
#mount none /tmp -t tmpfs -o size=$size,nosuid,nodev,mode=1777
#mount none /tmp -t tmpfs -o size=5242880,nosuid,nodev,mode=1777
mount none /tmp -t tmpfs -o size=2621440,nosuid,nodev,mode=1777
......

I've restart the router but i see that thare aren't changes.

root@noverca05:~# free
              total         used         free       shared      buffers
  Mem:        30512        14684        15828            0           52
 Swap:            0            0            0
Total:        30512        14684        15828
root@noverca05:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 7.2M      5.1M      2.1M  71% /
none                      2.5M     60.0k      2.4M   2% /tmp
/dev/scsi/host0/bus0/target0/lun0/part1      3.6G      8.5M      3.6G   0% /mnt/disc0_1

...in sense that the /tmp filesystem is now 2.4 Mb, but free memory is fixed.

Can someone explain to me about this?
Is the kernel the problem?

Regards

tmpfs doesn't allocate its free space. It only reserves the RAM it really needs. The size parameter only defines the maximum space to be used.

cozmic wrote:

tmpfs doesn't allocate its free space. It only reserves the RAM it really needs. The size parameter only defines the maximum space to be used.

OK.
But is it possible to reduce the /tmp dimension, increasing free memory?

Regards

No, you can only limit the maximum amount of memory used. In your example, the tmpfs filesystem uses only 60K RAM. 2.4M are free and therefore not occupied.

To free RAM you can only leave out unused processes and kernel modules. Check with 'ps' and 'lsmod'. And check free memory with 'cat /proc/meminfo'. 'free' doesn't list the amount of memory used for file cache.

OK cozmic,
i know.
Thank a lot.

The discussion might have continued from here.