4

I have yet another question about "where is my Linux memory"

Question goes: can I use cache for application data?

On my laptop I have 1GB ram. Situation after some time of work: browser takes 400MB and all other apps caa 300MB (quickly summed in system monitor). System monitor says I use 90% of RAM and I have already 200MB on swap. Laptop is getting slower when I start new things (e.g. open new tab in browser or open new Nautilus window). probably putting memory on swap

So there should be 1200MB (ram+swap) used but all app I see uses only 600MB. Where are other 600MB? Out of this 600MB there is 400MB real RAM.

I am not copying or any other massive IO activity.

I read about Linux smartly uses all ram it has using buffers and cache. So, kernel (cache) uses 300MB. What if I don't want to have disk mirrored and I want to use memory for application data (e.g. new browser tab)? I don't need 200MB of mirrored disk data, because I (for example) won't use open the same photos on data partition I just seen.

So can I use all my RAM for application data? (including browser, desktop, xorg, other services). How?

2
  • Could you please provide the output of the command free from the Terminal (when the situation you describe happens)? A few numbers are usually better than thousand words.
    – arrange
    Feb 13, 2011 at 19:37
  • @arrange: Sorry, I can't currently, because I need to run laptop for some time. Usually when it's fresh booted (1hr) does not make problem. I will try to provide free output
    – gsedej
    Feb 14, 2011 at 8:31

2 Answers 2

4

Applications use ram on their own; you don't have to DO anything. Whatever ram ISN'T in use by applications is used to cache recently accessed files to speed things up if they are needed again, thus between the two, ram usage is usually close to 100%. As applications request more ram, the cache gives it up.

1
  • This is usually true and I don't have problem when it is... but when I suppose to have like 25% more of free RAM and computer starts to freeze (e.g. start using swap).
    – gsedej
    Feb 14, 2011 at 8:35
-1

Try setting the swapiness to 100, it should improve performance in your machine and avoid freezes by making a more intensive usage of the swap, keeping only what is active on memory.

See here how to do : https://help.ubuntu.com/community/SwapFaq#What%20is%20swappiness%20and%20how%20do%20I%20change%20it?

4
  • No, using swap is what slows things down. If you increase swapiness, then it will get even slower. You want to DECREASE swapiness if you have too much ram in the cache and want to use less swap to speed things up.
    – psusi
    Feb 13, 2011 at 21:04
  • 1
    If you have a lot of ram, it's better not to use swap but in this case it's different. When you have an aggresive use of the swap the ram is tranfer progressively to the swap and the ram is never full, but when the swapiness is low if the ram is full your computer freeze or get incredibely slow. That's why I suggest gsedej to try this, I'm sure he'll see by himself that even if the computer is 5% more slow (which I don't think would be the case) it's better not to have freezes or to have a very slow response when you use your computer for Web. Feb 13, 2011 at 22:17
  • Thanks for help. But I actually said I should have 400MB of real RAM that I want to use for my apps. When I am extensively browsing web I don't need to have 200MB disk mirrored on RAM.
    – gsedej
    Feb 14, 2011 at 8:37
  • You should at least try it. You said that your computer freeze when it start using swap and this won't happen if you set swapiness to 100. Feb 21, 2011 at 6:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .