LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Something is eating my memory (https://www.linuxquestions.org/questions/linux-software-2/something-is-eating-my-memory-258376/)

benne 11-23-2004 10:17 AM

Something is eating my memory
 
Howdy!

I just fired up cedega for the first time and it (i think it is cedega that is doing it) starts eating all of my memory and i cant get it back. According to the pricesses listed in ps and top, i should only be using a few % of my memory, but free -m tells a different story;

Code:

            total      used      free    shared    buffers    cached
Mem:          1009        998        10          0          9        260
-/+ buffers/cache:        728        280
Swap:        2055          0      2055

And I am not happy at all. I have tried killing lots of processes, shutting down X and loads of other stuff, but it stays put as it is.

Is it possible that there is some background process eating all of my memory? Can I list those in any way?

Cheers,
Benne

rjlee 11-23-2004 11:02 AM

See http://www.linuxquestions.org/questi...hreadid=257888

foo_bar_foo 11-23-2004 11:27 AM

this is not a problem -- you have no swapping going on !
so in a nutshell an operating system kernel that DOES NOT use up all you memory and leaves memory free for absolutely no reason is a kernel that is poorly designed.....

you have to stop looking at memory in the old way empty vs used
ALL memory in Linux is a virtual abstraction and each and every running process has 100% access to all of your RAM.
The only thing that actually is taking up space in you memory is some page mapping tables.

benne 11-23-2004 12:54 PM

My swap is on and has been since i installed gentoo quite a while ago. And i have change swapiness to 100.
Code:

# echo 100 > /proc/sys/vm/swappiness
And the applications that were up (i shut down everything, inluding X, exepct a few server prcoseeses (sshd, apache, smbd/nmbd) simply can't take up 800 mb of ram. So i figured that maybe the harware was filling all the cache and all the memory so i unloaded the nvidia module and did "free -m" again, no change.

foo_bar_foo 11-23-2004 03:34 PM

you are missing what i say entirely (reread last post and let it soak in)
ALL MEMORY IS VIRTUAL AND ALL PROCESSES HAVE ACCESS TO ALL MEMORY ALL THE TIME !!!!!!!!!
then stop looking at "top"

Quote:

My swap is on
i mean
[qoute]
Swap: 2055 0 2055
[/quote]

no swap used = no swap needed = no pressure on memory

the kernel will only free memory when the system comes under pressure to need freed memory
and it will imediately get used again........

i have no idea why you think that when you close applications it should look like freed memory
what would be the point of it doing that ?????

benne 11-23-2004 03:48 PM

Ok, I am a experinsed programmer so I know how memory is hadled, but unforunely i am quite new to linux (ive been using it for about a year now). Lets say a application needs lots of arrays. E.g. the arrays need 50 mb of memory. When the application quits, the arrays also quit, and therefor the data that they had in them, disappears from me beloved memory.

But are you saying that is is entierly ok. I have , now while im wrint, 167mb fee of 1 gb and i am merely doing anything (i have trouwn cedega out). Can't be. And my swap is active. And for some reason, nothings gets stored there.


Code:

            total      used      free    shared    buffers    cached
Mem:          1009      1001          7          0        15        141
-/+ buffers/cache:        843        165
Swap:        2055        64      1990

This is just riddiculus..

benne 11-23-2004 04:26 PM

Quote:

Originally posted by foo_bar_foo
i have no idea why you think that when you close applications it should look like freed memory
what would be the point of it doing that ?????

Just to make sure, is it OK for Linux to have only 10% of the memory free, that is, if it needs more memory, does it clean the mem to make space for the new stuff?

butler 11-23-2004 04:27 PM

You just don't get it. The kernel uses all spare memory as it sees fit. For things like caching to make the system faster... you are not out of memory.

benne 11-23-2004 04:47 PM

Why cant it just put that part of the memory into the cache colomn in /proc/meminfo? And more important, why did this happen when i fired up that crappy cedega?

benne 11-24-2004 11:35 AM

Alright i'll rewrite my question: How do I put pressuere on the RAM so it will swap the uneccesary stuff then? Beacsue it is getting really slow here, only 71 mb free right now.

95se 11-24-2004 12:01 PM

Ok... hold on. The reason you see linux take up a bunch of "memory" is it's write caching. Basically, when ever something is to be written to disk or whatever, instead of linux writing it directly to disk it will cache it in memory first. It then waits for a more opportune time to then write the data as well as speeds up your writes a lot. When running "free -m" the second line shows -/+ buffers/cache. This is your memory NOT including the cache of writes it has stored. This SHOULD be how much your programs are taking up, which also shouldn't be a lot. It's 70 MB used on my computer booted into X w/ firefox right now. Nowhere close to 700MB! (It is usually under 100 unless I'm playing games). I would suggest this as a good time to upgrade. Maybe some program had a bug/memory leak... Even an unstable driver your using.

benne 11-24-2004 12:25 PM

95se: Exactly my point, it cant be the kernel that has decied to eat my memory. If it would, then my computer would be faster, not slower. When i boot up, maybe ca 70-100 mb are in use. And after firng up som applications it maybe is about 140 mb in use.

I first though that the nvidia driver was leaking memory (since the MEM dissapered while playing a a game) but i shut it down, no change. I im running the newest nvidia-kernel and nvidia-glx modules (according to emerge)

Code:

*  media-video/nvidia-glx
      Latest version available: 1.0.6111
      Latest version installed: 1.0.6111
      Size of downloaded files: 15,138 kB
      Homepage:    http://www.nvidia.com/
      Description: NVIDIA X11 driver and GLX libraries
      License:    NVIDIA

*  media-video/nvidia-kernel
      Latest version available: 1.0.6111-r3
      Latest version installed: 1.0.6111-r2
      Size of downloaded files: 15,138 kB
      Homepage:    http://www.nvidia.com/
      Description: Linux kernel module for the NVIDIA X11 driver
      License:    NVIDIA

So doubt it is the nvidia driver. Time for a kernel update? Maybe.

Code:

*  sys-kernel/gentoo-dev-sources
      Latest version available: 2.6.9-r4
      Latest version installed: 2.6.8-r3
      Size of downloaded files: 35,607 kB
      Homepage:    http://dev.gentoo.org/~dsd/gentoo-dev-sources
      Description: Full sources including the gentoo patchset for the 2.6 kernel tree
      License:    GPL-2

Somehow i doubt that it is the kernel. Maybe it is just cedega that is fucked up. But it didnt leave any traces in ps -aux or top.

foo_bar_foo 11-24-2004 04:21 PM

Quote:

Originally posted by benne

This is just riddiculus..

yes this is riddiculus
just read about linux kernel
there are numerous papers on linux mem management
and if you know code the kernel code is open source
so i think you should not be posting about how it works this way or that way untill you at least understand how it actually works !!!!!!!
if you then have some problem with kernel developement take it up with the team -- sumbit fixes or alternatives -- or start a new kernel branch that works to your liking.....
you have confused mem allocation in c with kernel level page table management and allocation.

Quote:

Originally posted by 95se
The reason you see linux take up a bunch of "memory" is it's write caching. Basically, when ever something is to be written to disk or whatever, instead of linux writing it directly to disk it will cache it in memory first.
no this is not what the memory cache is that shows up in free !!!!
cache is about things read from the disk.

Quote:

How do I put pressuere on the RAM so it will swap the uneccesary stuff
there is rarely any reason to write data to a swap. Rather the data is just thrown out.....
if you must for some reason see swap use something like a video/audio editing program that stores lots of unique local data
and then ignores it for a long time and leave the program open don't close it..
also leave a bunch of other stuff running and ignore it for a long time and don't close them.
Then start up doing other stuff opening other programms etc and you wil see swap.
as the system tries to hold onto local data for the still open apps.

Quote:

Beacsue it is getting really slow here, only 71 mb free right now.
we have no idea why you equate 71mb free with "slow"
71mb free is exactly what will make often used applications start faster
(like cedega) or each time you start it do you actually want to set there and wait for it to load all those libraries instead of have it start right away ???????????? if that's the case then you will have to rewrite your kernel so it works all wrong. your cpu has a memory management unit that is 4gigs wide ! why not use it ?????
if you have problems with things running slow then tell us about those problems
ram problems often show up as unresponsive mouse or keyboard or frozen gui..
do you have those things going on ????
ok cedega is crap and slow we know that but i mean otherwise ???????
we also know most distributions run like crap out of the box but that is another issue as well.

benne 11-24-2004 04:44 PM

Quote:

we also know most distributions run like crap out of the box but that is another issue as well.
Mine was never in a box, im running Gentoo, compiled and set up from stage 1. I configured the kernel (2.6 gentoo sources) to make it fit for my purposes. Tuned for my computer and I would definently NOT call my setup of gentoo crap.

Quote:

each time you start it do you actually want to set there and wait for it to load all those libraries instead of have it start right away ????????????
Note that i said that everything (like opening programs) is going relly slow. If libraires and stuff (for nearly a whole gb) are loaded in the memory, wouldnt that make the programs start FASTER, not SLOWER?

Quote:

ok cedega is crap and slow we know that but i mean otherwise ???????
I know it is crap. Now it doesnt exist on my system anymore. But why the *** should cedega decide that "hey this guy has 1 gb of mem, lets use it all". That must have loaded stuff that ONLY cedega needed into the memory and no other application. And it didnt clean it out of the memory like every other well behaving application would do. What is the point of that??

Quote:

[...] away ???????????? if t[...]
Whats up with all the question marks? Isnt one of them enough :rolleyes:

foo_bar_foo 11-24-2004 10:26 PM

http://sourcefrog.net/weblog/softwar.../free-mem.html
http://sourcefrog.net/weblog/softwar...rnel/swap.html

you should use resources lke this and many others to figure out how linux is designed to work rather than bothering us

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!


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