LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   reducing RAM usage (https://www.linuxquestions.org/questions/slackware-14/reducing-ram-usage-308207/)

Furlinastis 03-31-2005 09:09 AM

reducing RAM usage
 
I am using KDE atm ... 512MB RAM, 2GB swap

I want to know how to free up RAM and cache .... when I do a cold boot there is about 75-80MB of RAM ... after an hour of surfing the web I close my browser(firefox) and there is 200MBs ... I realize this is because it keeps stuff cached for easy access ... and perfectly normal

but my problem I run into is I do Folding@Home with this PC and leave it on 24/7 and after about 2 weeks my swap file can grow to 1.5GBs:eek: ... and this has a big effect on performance since it has to search through that to get at files and images, etc

So how do I remove temp internet files, cache, etc etc from the RAM?

Mega Man X 03-31-2005 09:15 AM

That sounds more like a mem leak then temp or cache files. What program is the one taking so much RAM?. Run "top" to find it out...

macemoneta 03-31-2005 09:17 AM

There are many tuning knobs for virtual memory control, but probably the most effective for your issue is the swappiness:

cat /proc/sys/vm/swappiness
60

By reducing this number, you reduce the system's tendency to swap (putting more pressure on the cache). Less information will be kept in cache (meaning increased I/O), but for your particular situation it might be effective.

I suggest adding the following to /etc/rc.d/rc.local before a reboot:

echo "20" > /proc/sys/vm/swappiness

If the system remains more responsive over a longer interval, then it is working for you.

Furlinastis 03-31-2005 09:42 AM

Quote:

Originally posted by Megaman X
What program is the one taking so much RAM?. Run "top" to find it out...
I actually did a complete reinstall yesterday ... so I was more of asking how to prevent it from happening as I just figured it would do it again ... and I only run F@H, firefox, AMSN IMer, then maybe your oddball program like the Gimp or whatever

irt mace ... thnx I'll do that soon as I get back I have to step out a bit

but isn't there a temp directory like windows(i know that's a bad word around here:p ) has? in which I could clear every week or so, as I fail to see the point of keeping all that internet and system clutter around

oneandoneis2 03-31-2005 09:44 AM

Maybe use WM that's smaller than KDE. . ?

chbin 03-31-2005 09:58 AM

Yeah there is a /tmp directory but it is not mapped into /dev/shm by default so it shouldn't be taking up ram. The correct way to delete it is to switch into single user mode "init 1" and then it is safe to just rm everything there and then init 3 back into multi user mode.

You could also rm it in your shutdown script which is what I do, but since you never reboot just "init 1" and rm it.


Also linux doesn't give back memory that applications use right away it will hold on to it for a while just in case you start up again. To get a true measure of how much ram you are using do a "free -m"... take the used and subtract the cache.

Funny I only have 256 MB of ram and box almost never uses more than a MB or so of swap. And after 10 minutes or so when I'm doing do whatever mem intensive things it will drop back down to zero. You may have a mem link. what is f@h?

macemoneta 03-31-2005 10:02 AM

Quote:

Originally posted by Furlinastis
but isn't there a temp directory like windows(i know that's a bad word around here:p ) has? in which I could clear every week or so, as I fail to see the point of keeping all that internet and system clutter around
The system will automatically age old files in the /tmp directory, there's no need to clean it out manually (and you can't just delete the contents; programs will fail).

In any case, the contents of the /tmp directory and things like browser cache are disk files. They are not the cache that is being referred to in memory (RAM).

chbin 03-31-2005 10:08 AM

Quote:

Originally posted by macemoneta
The system will automatically age old files in the /tmp directory, there's no need to clean it out manually (and you can't just delete the contents; programs will fail).

In any case, the contents of the /tmp directory and things like browser cache are disk files. They are not the cache that is being referred to in memory (RAM).

In slack they will stay forever unless you add it to your shutdown script or "init 1" rm it. Also programs wont fail if you "init 1" and rm it and then go back "init 3".

cavalier 03-31-2005 10:08 AM

I think I'd have to echo Mace on this one.

First, the memory that's being used, that's honestly just cached things that aren't yet freed up. They don't get written to disk, and get reused at need, so no sweat there.

Second, firefox does keep a cache that's much like the old "Temporary Internet Files" model - in ~/.mozilla/firefox directory, I think.

gbonvehi 03-31-2005 10:10 AM

Furlinastis I would try stop using your programs one at the time to see which one has a memory leak. I've two computers 24/7 both running F@H and never had a problem with them.
The swap is not used by temporary files but for programs to get more memory, so try not using ie: amsn for two weeks and see what you have. If you still have a swamp overload try not running another program, etc.

chbin, F@H or Folding@Home a project similar to SETI@Home but for looking different things about proteins and related stuff. The homepage is: http://folding.stanford.edu/

alienDog 03-31-2005 10:42 AM

Cleaning up /tmp (and /var/tmp) is safe as long as you don't delete recent tempfiles. I've had a script like this:

Code:

#!/bin/bash
find /tmp -type f -atime +3 -exec rm {} \;
find /var/tmp -type f -atime +27 -exec rm {} \;

in my cron.daily for as long as I can remeber and have never had any problems with it. It considers files in /tmp outdated if they are last accessed more than 3 days ago. For /var/tmp, files accessed more than 27 days ago are considered outdated.

macemoneta 03-31-2005 04:28 PM

Quote:

Originally posted by chbin
In slack they will stay forever unless you add it to your shutdown script or "init 1" rm it. Also programs wont fail if you "init 1" and rm it and then go back "init 3".
I'm surprised; most distributions I've looked at are using tmpwatch to age the /tmp directory. I wasn't aware that Slack doesn't provide this. Thanks for the info!

chbin 03-31-2005 04:37 PM

Pat ships it pretty much unmodified. He only adds things that are absolutely essential to get it to boot. The odds and ends are up to you and you alone. Who knows maybe someone wants to keep it around... and doesn't want it deleted. Perhaps they use temp to compile and build source. Who knows.

Jeebizz 03-31-2005 05:06 PM

I think one thing that might worth knowing, is what exactly are you running? Are you running current, 10.1 , or 10.0? Since, also there is a different KDE version in each

Furlinastis 04-01-2005 04:31 PM

Quote:

Originally posted by macemoneta
There are many tuning knobs for virtual memory control, but probably the most effective for your issue is the swappiness:

cat /proc/sys/vm/swappiness
60

I can't seem to find that file:confused: ... I have the following in /proc/sys/vm:
bdflush
block_dump
kswapd
laptop_mode
max-readahead
max_map_count
min-readahead
overcommit_memory
page-cluster
pagetable_cache
vm_cache_scan_ratio
vm_gfp_debug
vm_mapped_ratio
vm_passes
vm_vfs_scan_ratio

Quote:

Originally posted by alienDog
Cleaning up /tmp (and /var/tmp) is safe as long as you don't delete recent tempfiles. I've had a script like this:

Code:

#!/bin/bash
find /tmp -type f -atime +3 -exec rm {} \;
find /var/tmp -type f -atime +27 -exec rm {} \;

in my cron.daily

there are two files in that folder:
logrotate
slocate
which file should I add that script to? or should I just create a new file? if so what should I name it?

TIA:D

(BTA I'm using 10.0)


All times are GMT -5. The time now is 10:36 PM.