LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   High memory usage? (https://www.linuxquestions.org/questions/linux-general-1/high-memory-usage-260022/)

Davus 11-27-2004 11:00 PM

High memory usage?
 
When booting my Linux box, its memory usage was very high within 6 minutes. I have 256MB RAM on the thing, and 3MB or less was fee. It doesn't seem that a single application is using hundreds of MB of RAM so I'm not sure what's going on. Here's a "ps aux;uptime;free" dump:
kidindustries.net/dump.txt
Real-time stats available at kidindustries.net/servstat.php

See anything causing this? o_O Or maybe my RAM stick is messed?

I upgraded the RAM from 128 to 256 because of this problem, and in the time of 128 it had about 2 MB free with 0 swap used, now it's repeating on 256 except using more to fill the 256.

P.S. netstat -a also added to dump, just in case.
P.S.S. I also noticed MySQL using a bit of memory...

student04 11-28-2004 01:29 AM

Linux tends to handle memory different than windows does. Are you using any large window manager, such as KDE or GNOME? Those can take up a large amount of memory easily. Also, linux will tend to fill up the memory, but that doesn't mean that you need more, it is just how system resources are handled. I don't think i can be anymore clear, because i haven't studied this yet; i just know that memory usage isn't something to worry about (especially with 256, which is a small amount these days...). I have 512MB of RAM on my laptop, and only between 0-50MB is free anytime i look. Yet it does not run slowly, it's just a different way of managing your computer's resources. Running servers such as apache, mysql, ftp can increase the amount of memory usage depending on how many outsiders are accessing your server. Are you running anything besides mysql?

dalek 11-28-2004 01:30 AM

That is normal for Linux. I have 1Gb in my machine and it uses almost all of it. This is mine:

Code:

root@smoker / # free
            total      used      free    shared    buffers    cached
Mem:      1034728    847152    187576          0    204064    250720
-/+ buffers/cache:    392368    642360
Swap:      488336          0    488336
root@smoker / #

What you want to watch is the swap. If it starts to using a !lot! of swap then you need more memory. 256Mb should be fine for most applications and just surfing the net.

The way Linux does is this: You open a app then close it. The app stays in memory unless you open another app that needs that memory. It caches the program. Note the "cached" part above in mine. Why, because the memory is faster to access than the hard drive, much faster in fact. Memory is faster than a SCSI drive even. Linux will keep caching data until it needs the memory for something else, or it has filled it up. This is also why Linux can find bad memory so well.

If you see a few megabytes of swap, that is OK. Even mine sometimes uses a little bit and I don't do any video stuff or anything that uses more memory than Mozilla or KDE. Mozilla can be a hog though.

I used to have 512Mbs of memory and upgraded to 1Gb. To be honest, I didn't see much difference. 256Mbs is good, 512Mbs is a bit better, any more than that for just surfing and such is overkill. I don't regret the upgrade but it did not really improve anything.

Hope that helps. This has been asked numerous times. I have even answered the question before. :rolleyes:

Later

:D :D :D :D

Davus 11-28-2004 01:33 AM

By the way, this is a server instead of a client, so KDE/Gnome/Mozilla are out.
I'm running FTP, SSH, SMTP, HTTP, SQL, and IRC.
So basically the server is pushing aside memory but it's still available? Odd memory management ways, would make one unable to know how much memory is actually being used at a time.

dalek 11-28-2004 01:55 AM

Until it starts using a !lot! of swap space, like 100Mbs or so, which is a indication that it is out of memory, it is doing fine. As I said though, it may use a bit of swap from time to time. That is normal. I suspect that if you or I had 3Gbs of memory, it would still eventually use some swap. Just may take longer to get there.

You should be fine though. Memory management in Linux is much better than windoze. You close a app and it makes it available if it is needed. It is rare that I read of memory problems in Linux.

You are right though, it is hard to actually tell how much memory is really being used. You can use top and then hit the "m" key to sort by how much memory is being used. Just type in top and the command line. Hit "q" when you get ready to quit. It also shows memory usage at the top, cache and all. Hit "?" for help with the options.

Later

:D :D :D :D

btmiller 11-28-2004 02:22 AM

Look at the line +/- buffers/cache in the free output. That tells how miuch memory is actually available. The files /proc/meminfo has more detail, and /proc/slabinfo shows you what the kernel slab allocator (internal kernel data structures) is allocating is quite nauseating detail. Besides, what's the point of buying RAM if your OS only uses it occasionally? Linux makes sure you get your money's worth on your RAM.

dalek 11-28-2004 02:33 AM

Code:

root@smoker / # cat /proc/meminfo
MemTotal:      1034728 kB
MemFree:        185228 kB
Buffers:        206256 kB
Cached:        255916 kB
SwapCached:          0 kB
Active:        495040 kB
Inactive:      208308 kB
HighTotal:      131008 kB
HighFree:          252 kB
LowTotal:      903720 kB
LowFree:        184976 kB
SwapTotal:      488336 kB
SwapFree:      488336 kB
Dirty:              16 kB
Writeback:          0 kB
Mapped:        270672 kB
Slab:          129392 kB
Committed_AS:  274248 kB
PageTables:      1840 kB
VmallocTotal:  114680 kB
VmallocUsed:    26400 kB
VmallocChunk:    88220 kB
root@smoker / #

So mine would be 1034728000 - 185228000 - 206256000 - 255916000 which equals 387328000. That is what gkrellm shows, well pretty close anyway. My mozilla sucks up some memory. I have the Mozilla cache turned up a bit. Dial-up sucks. Mozilla uses 133Mbs on mine. I have seen it higher.

What is "dirty"? It shows that has 16kb. Just curious.

Oh, for the original poster, you ahve to cat those files. cat /proc/meminfo

Later

:D :D :D :D


All times are GMT -5. The time now is 05:54 PM.