LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-25-2007, 07:25 PM   #1
forsaken_pariah
LQ Newbie
 
Registered: Jan 2007
Location: Prattvegas
Distribution: Debian Etch, Kubuntu Feisty
Posts: 16

Rep: Reputation: 0
Unhappy memory usage


Hi,

I'm fairly new to linux (i've been experimenting since last summer but i've only been using it exclusively for about a month) and i just noticed my computer is using insanely high amounts of memory. When i first start my computer i'm only using 300~400MB out of 1024, but the longer my computer runs the higher the memory usage goes up, topping out at about 980~1000. Before i started using linux i used windoze vista rc1 and it only used somewhere around 50~55% and i thought that was crazy. Anybody know anything about this i don't? Is there any logical explanation for this? Or is my computer just completely stupid or going on strike or something? Any info would be greatly appreciated.

Thanks in advance,
the forsaken pariah
 
Old 01-25-2007, 07:32 PM   #2
Micro420
Senior Member
 
Registered: Aug 2003
Location: Berkeley, CA
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986

Rep: Reputation: 45
use the top command and see what is hogging the memory.

Code:
top
 
Old 01-25-2007, 07:42 PM   #3
forsaken_pariah
LQ Newbie
 
Registered: Jan 2007
Location: Prattvegas
Distribution: Debian Etch, Kubuntu Feisty
Posts: 16

Original Poster
Rep: Reputation: 0
I only see no more than 9 or 10 processes using any memory at a time, none of which use any more than 9% at a time, but only 2 or 3 of them are doing that much. Most of them are between 0.1% and just over 1%. I have no idea where it's all going.
 
Old 01-25-2007, 08:08 PM   #4
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,899

Rep: Reputation: 68
It's no reason to worry about. It's not amount of currently free memory that is important, it's amount of memory that can be easily freed. I mean that most of used memory is used to cache disk read results in case something needs them one (and then one more again) more time, or to buffer disk writes quickly to flush them asynchronously - while the program is running further. Run free and look in the second line. You see, I have free memory of 26MB out of 1280MB right now. No problem. I run memory hog to eat 100 MB... no problem, it eats 100MB and cache shrinks. Yes, in Windows it is possible that processes are swapping and disk cache is >150MB. I didn't see anything like that in Linux.
 
Old 01-25-2007, 08:32 PM   #5
forsaken_pariah
LQ Newbie
 
Registered: Jan 2007
Location: Prattvegas
Distribution: Debian Etch, Kubuntu Feisty
Posts: 16

Original Poster
Rep: Reputation: 0
Oh ok. Thanks. Now I see what you mean. KSysGuard's memory meter shows a sensor for memory used by applications, buffer, and cache. That makes a lot more sense. But that makes you wonder why Superkaramba's memory meters show only the total used memory instead of giving you the option to show just the memory used by applications... It's something to think about...
 
Old 01-25-2007, 08:46 PM   #6
JimBass
Senior Member
 
Registered: Oct 2003
Location: New York City
Distribution: Debian Sid 2.6.32
Posts: 2,100

Rep: Reputation: 49
It is just the different way linux deals with memory. Coming from win-world it is strange, when you're used to it, it is just what you expect.

Linux will allow things to live in memory, and until the call for more memory is issued, it just stays there. If you had a new server motherboard with literally 32 Gb of RAM, you would just see usage go up and up, until it hit about 31.8 Gb, and then it would never go any higher. As requests for RAM came in, it would drop old data out of the cache, and you'd be set.

Peace,
JimBass
 
Old 01-25-2007, 09:02 PM   #7
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,275

Rep: Reputation: 126Reputation: 126
"Linux will allow things to live in memory, and until the call for more memory is issued, it just stays there. If you had a new server motherboard with literally 32 Gb of RAM, you would just see usage go up and up, until it hit about 31.8 Gb, and then it would never go any higher."

Jim, I saw exactly what you're talking about in a previous kernel, but I'm not seeing that anymore. One of Emerson's posts pointed me at http://gentoo-wiki.com/FAQ_Linux_Mem...2.6_kernels.29 where they talk about "swappiness". I haven't played with it, but the sysctl is set to 60 on my machine.
Quote:
Swappiness takes a value between 0 and 100 to change the balance between swapping applications and freeing cache. At 100, the kernel will always prefer to find inactive pages and swap them out; in other cases, whether a swapout occurs depends on how much application memory is in use and how poorly the cache is doing at finding and releasing inactive items.

The default swappiness is 60. A value of 0 gives something close to the old behavior where applications that wanted memory could shrink the cache to a tiny fraction of RAM. For laptops which would prefer to let their disk spin down, a value of 20 or less is recommended.

As a sysctl, the swappiness can be set at runtime with either of the following commands:

sysctl -w vm.swappiness=30
echo 30 >/proc/sys/vm/swappiness
 
Old 01-25-2007, 09:32 PM   #8
JimBass
Senior Member
 
Registered: Oct 2003
Location: New York City
Distribution: Debian Sid 2.6.32
Posts: 2,100

Rep: Reputation: 49
Quote:
When an application needs memory and all the RAM is fully occupied
So you still need to basically fill your RAM before swappiness would take effect. Even then, all you are influencing is if it throws out old data in RAM, or goes to the swap partition to use memory space there. Unless you are maxing out your RAM, swappiness won't have a chance to take effect. My desktop has 1 Gb of RAM, and 512 Mb of swap, and I've never seen it write to swap. My laptop however has only 256 Mb of Ram, and I live in my swap space all the time. Same deal as I mentioned earlier, like a teenage houseguest, programs don't just get up and leave memory space. Until and unless they are thrown out, they will stay there as long as possible.

Just like on a hard disk, if you put 38 Gb of data on a 40 Gb disk, then erase 4 Gb, your disk would say it has 6 Gb free, which is true, but until something writes over the 4 Gb of erased space, all of that data is still sitting there, just marked that it is actually free space, and can be overwritten. So when your 1 Gb of Ram tells you 950 Mb is used, that is true, but probably 600 or so Mb of that 950 is just cached garbage from before, and if a request came in for Ram space, it would be given up in a heartbeat.

Peace,
JimBass
 
Old 01-25-2007, 10:02 PM   #9
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,275

Rep: Reputation: 126Reputation: 126
Well, I dunno then. I've got 1GB in this machine and 2GB in the other and I rarely ever see memory usage above about 200 MB, whether I'm doing copies on large ISOs or compiling a kernel or what. Some prior kernel when I first switched from W2K, probably 2.4 used memory as you describe. I can't remember exactly when I noticed memory usage change. Swap sits mostly less than 100KB.
 
  


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
memory usage ololad8 Linux - Hardware 1 07-16-2006 09:18 AM
Memory Usage Spaw Usage Swappiness Issues joelunch Linux - Software 3 01-04-2006 07:16 PM
getting realtime info on memory usage-cpu and harddrive usage steering Linux - Newbie 5 03-03-2005 09:43 PM
how to determine cpu usage, memory usage, I/O usage by a particular user logged on li rags2k Programming 4 08-21-2004 05:45 AM
Controlling CPU usage & memory usage Saravana babu Linux - Software 0 02-18-2004 06:55 AM


All times are GMT -5. The time now is 04:08 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration