LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-09-2004, 09:26 PM   #1
flamesrock
Member
 
Registered: Aug 2003
Distribution: Gentoo 2006.1
Posts: 405

Rep: Reputation: 30
Command to clear RAM?


Hi,

Thanks to the help of some knowledgeable people(here and elsewhere), I managed to succusfully set up a server.

Unfortunately, whenever I import a large file using apache/php/mysql, it gets stuck in the RAM. For some reason, its never flushed.

So my question is this: Is there a command to flush the RAM of stuff thats not doing anything? Or a program maybe?

-Thanks

Last edited by flamesrock; 03-09-2004 at 09:27 PM.
 
Old 03-09-2004, 09:57 PM   #2
wapcaplet
LQ Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
I'm not a memory allocation expert, but I'm fairly certain that flushing out unused RAM is the kernel's job; it's something that should happen automatically.

How do you know your imported file is "stuck" in RAM? What does the output of 'free' (run from the command-line) show?
 
Old 03-09-2004, 10:31 PM   #3
contrasutra
LQ Guru
 
Registered: Mar 2003
Location: New Jersey
Distribution: Arch Linux
Posts: 1,445

Rep: Reputation: 47
UNIX kernels aggressively cache things in RAM. It's not uncommon to have 99% of your RAM filled, even when idle.

That's a good thing. What is the point of having free RAM, it doesn't speed you up at all? It's there to be used, so the OS should efficiently use it.

So fear not, the kernel can handle memory management. ;-)
 
Old 03-09-2004, 10:33 PM   #4
flamesrock
Member
 
Registered: Aug 2003
Distribution: Gentoo 2006.1
Posts: 405

Original Poster
Rep: Reputation: 30
I too thought that job belonged to linux. Can you make out anything from the information below?


09:26:34 up 4:40, 2 users, load average: 0.09, 0.11, 0.03

53 processes: 52 sleeping, 1 running, 0 zombie, 0 stopped

CPU states: 0.0% user 0.3% system 0.0% nice 0.0% iowait 99.6% idle
Mem: 385824k av, 245576k used, 140248k free, 0k shrd, 35836k buff
99668k active, 128664k inactive

Swap: 610428k av, 12144k used, 598284k free 171876k cached



PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
2062 root 12 0 1524 1480 1320 S 0.1 0.3 0:00 0 sshd
2076 root 14 0 1024 1024 816 R 0.1 0.2 0:00 0 top
1 root 8 0 76 68 52 S 0.0 0.0 0:05 0 init
2 root 8 0 0 0 0 SW 0.0 0.0 0:00 0 keventd
3 root 18 19 0 0 0 SWN 0.0 0.0 0:00 0 ksoftirqd_CPU
4 root 9 0 0 0 0 SW 0.0 0.0 0:00 0 kswapd
5 root 9 0 0 0 0 SW 0.0 0.0 0:00 0 bdflush
6 root 9 0 0 0 0 SW 0.0 0.0 0:00 0 kupdated
10 root -1 -20 0 0 0 SW< 0.0 0.0 0:00 0 mdrecoveryd
11 root 9 0 0 0 0 SW 0.0 0.0 0:00 0 kreiserfsd
136 root 9 0 0 0 0 SW 0.0 0.0 0:00 0 eth0
166 root 9 0 0 0 0 SW 0.0 0.0 0:00 0 khubd
809 root 9 0 608 588 528 S 0.0 0.1 0:00 0 syslogd
812 root 9 0 440 388 388 S 0.0 0.1 0:00 0 klogd
815 root 9 0 520 464 464 S 0.0 0.1 0:00 0 inetd
818 root 9 0 1088 972 884 S 0.0 0.2 0:00 0 sshd
 
Old 03-09-2004, 10:47 PM   #5
flamesrock
Member
 
Registered: Aug 2003
Distribution: Gentoo 2006.1
Posts: 405

Original Poster
Rep: Reputation: 30
woops! posted that before I saw your reply. Thanks. that makes perfect sense.

So if a task needs memory, an idle one will be terminated?
 
Old 03-10-2004, 02:18 AM   #6
urzumph
Member
 
Registered: Jan 2004
Location: Australia
Distribution: Debian
Posts: 168

Rep: Reputation: 30
No, it will simple remove un-needed information from ram or write to swap. Should you run out of ram + swap, then I think the most memory hogging process is killed. (This can be configured further in 2.6.x I believe)
 
Old 11-22-2004, 05:41 PM   #7
midtown266
LQ Newbie
 
Registered: Nov 2004
Location: Michigan, US
Distribution: Gentoo
Posts: 9

Rep: Reputation: 0
hey, ive got another question, so if the ram is filled, and linux starts writing to the swap, what if our swap is a whole heck of a lot slower, and I would much rather have it write to the ram.

Im asking this because my ram gets filled up, and then it starts writing to my swap, but my swap is an old piece of crap hard drive i stuck in there for extra storage, so does it put the new processes in the ram and move old ones to swap? Or does it just write the new processes to anything thats open?
 
Old 11-22-2004, 06:25 PM   #8
scuzzman
Senior Member
 
Registered: May 2004
Location: Hilliard, Ohio, USA
Distribution: Slackware, Kubuntu
Posts: 1,851

Rep: Reputation: 47
New ones go to RAM, then, as a process is brought to the foreground, it's taken from swap and put into RAM, and one from RAM is put into SWAP
 
Old 11-22-2004, 06:38 PM   #9
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Rep: Reputation: 45
Quote:
Originally posted by scuzzman
New ones go to RAM, then, as a process is brought to the foreground, it's taken from swap and put into RAM, and one from RAM is put into SWAP
is that true for both windows and *nix? IIRC that is how windows handels swap too, just not as effective as *nix at keeping things were it belongs.
 
Old 11-22-2004, 06:41 PM   #10
scuzzman
Senior Member
 
Registered: May 2004
Location: Hilliard, Ohio, USA
Distribution: Slackware, Kubuntu
Posts: 1,851

Rep: Reputation: 47
AFAIK that's how its done in both. I do know though, that win makes mistakes a lot and "forgets" to move something into RAM and out of the paging file before trying to execute it. But, in essence, they're supposed to work roughly the same.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
flush my swap/ram? command? lefty.crupps Linux - General 34 04-02-2011 12:59 AM
how do i replace the clear "clear screen" with the cls command thefedexguy SUSE / openSUSE 2 12-02-2005 05:02 PM
history clear command suguname Linux - Newbie 5 03-05-2005 09:32 AM
RAM install check command u-b-u-n-t-u Linux - Newbie 3 02-23-2005 02:50 PM
Always clear last command GUIPenguin Linux - General 3 09-14-2004 04:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration