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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-09-2004, 09:26 PM
|
#1
|
Member
Registered: Aug 2003
Distribution: Gentoo 2006.1
Posts: 405
Rep:
|
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.
|
|
|
03-09-2004, 09:57 PM
|
#2
|
LQ Guru
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018
Rep:
|
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?
|
|
|
03-09-2004, 10:31 PM
|
#3
|
LQ Guru
Registered: Mar 2003
Location: New Jersey
Distribution: Arch Linux
Posts: 1,445
Rep:
|
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. ;-)
|
|
|
03-09-2004, 10:33 PM
|
#4
|
Member
Registered: Aug 2003
Distribution: Gentoo 2006.1
Posts: 405
Original Poster
Rep:
|
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
|
|
|
03-09-2004, 10:47 PM
|
#5
|
Member
Registered: Aug 2003
Distribution: Gentoo 2006.1
Posts: 405
Original Poster
Rep:
|
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?
|
|
|
03-10-2004, 02:18 AM
|
#6
|
Member
Registered: Jan 2004
Location: Australia
Distribution: Debian
Posts: 168
Rep:
|
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)
|
|
|
11-22-2004, 05:41 PM
|
#7
|
LQ Newbie
Registered: Nov 2004
Location: Michigan, US
Distribution: Gentoo
Posts: 9
Rep:
|
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?
|
|
|
11-22-2004, 06:25 PM
|
#8
|
Senior Member
Registered: May 2004
Location: Hilliard, Ohio, USA
Distribution: Slackware, Kubuntu
Posts: 1,851
Rep:
|
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
|
|
|
11-22-2004, 06:38 PM
|
#9
|
Senior Member
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765
Rep:
|
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.
|
|
|
11-22-2004, 06:41 PM
|
#10
|
Senior Member
Registered: May 2004
Location: Hilliard, Ohio, USA
Distribution: Slackware, Kubuntu
Posts: 1,851
Rep:
|
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.
|
|
|
All times are GMT -5. The time now is 12:21 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|