Why is zero swap being used on my setup?

19,945

Solution 1

Swap is kind of a "safety net" in case you run out of RAM, so the fact that it's not used until actually needed is entirely normal.

You're not using any swap because all the processes fit in your RAM. You won't actually see swap being used util processes actually need more space. Try opening a lot of tabs on your browser, or install the stress tool which you can use to stress your system's memory, and you will see swap being used.

Solution 2

Well I have a system-indicator that seems to disagree with the above statements.
Firefox being my greatest offender, it does not want to play nice with others, but I have since been using Opera browser and I have less of a memory problem.

I am only guessing by behavior, but it seems FF wants to keep cache even after being closed. I have been told because you might want it again..da!..probably not!

Perhaps the old stuff could go to swap instead hogging my cache so other app's run slow. I was told forcing a cache clean would only run my CPU and load up, but I don't see this happening, and if it does maybe only for a fraction of a second.

Too often I have to clean my cache just so I can use something along with the browser, say Dropbox or Filezilla..ridiculous!

BTW...

    #/bin/bash
    sudo sync && sudo sysctl -w vm.drop_caches=3

Also why not have choice about things I don't use like Evolution this and that and that resource hog! Tracker and goa-daemon or some stupid inductor to tell me I am using my English keyboard. Bi-lingual should be a selection during setup if you want it..not a memory resident option!
I use root edit to edit /etc/xdg/autostart files and remove or change to

NoDisplay=true or display= true

or in bulk (careful)

    cd /etc/xdg/autostart/
    sudo sed --in-place 's/NoDisplay=true/NoDisplay=false/g' *.desktop

Then just uncheck the ones you don't want in Startup Applications RE: How do I add/remove the "hidden" startup applications?

Share:
19,945

Related videos on Youtube

Forty-Two
Author by

Forty-Two

OCCUPATION: English as Foreign Language (EFL) Teacher in Japan. MULTIMEDIA: Can answer scripting questions related to HTML, CSS, JavaScript, Jquery Can answer design questions related to Photoshop, Illustrator, Inkscape, Gimp, Synfig Can answer 3D questions related to Blender, Maya, Polygon, Nurbs, SubDivision modeling etc. Specialize in web design, graphic design, photography video and print FAMILY: Oldest of two brothers and one sister. Am currently married with no children as of yet :p INTEREST/HOBBY: Some things I really enjoy in random order are: Playing guitar Playing piano Going on dates with my wife Going to 3d theater with my wife Spending time with friends and with wife Studying Christian philosophy and theology and history Teaching people about God Reading Japanese manga Studying Japanese, Korean, Greek and Hebrew Watching japanese Anime Web design, html5 and css3 3D modeling using Open source software such as BLENDER Digital Photography and Graphic Design Old Christian HYMNs redone Family worship Reformed Theology and theological discussion and debate Neighborhood ecclesiology with christian fellowship and corporate worship based on location rather than association Teaching English to Japanese people RELIGIOUS BELIEFS: Soteriology: Doctrines of Grace, Three Forms of Unity, TULIP, 5 Solas Ecclesiology: Neighborhood fellowship, Obedience is worship, The word Ecclesia does not mean church and is usually used by the Jewish writers of the New Testament to refer to the word Qahal in Hebrew which refers to any number of a multitude of people. Spiritually it refers to God's elect multitude who belong to Him and were saved through Jesus' propitiating sacrifice which is often called "the invisible church" What theologians refer to as "the visible church" is often not explained well and should not refer to "a church" but should refer to believers anywhere living obedient lives of faith whether they are alone in a desert or members of a family or l

Updated on September 18, 2022

Comments

  • Forty-Two
    Forty-Two almost 2 years

    From the looks of the swaps proc;

    ubuntu:~$ cat /proc/swaps
    Filename                Type        Size    Used    Priority
    /dev/sdc2                               partition   4104188 0   -1
    ubuntu:~$ 
    

    And from top:

    ubuntu:~$ top
    
    top - 09:35:37 up  9:07,  9 users,  load average: 1.43, 0.80, 1.09
    Tasks: 206 total,   3 running, 202 sleeping,   0 stopped,   1 zombie
    Cpu(s):  4.4%us,  2.2%sy,  0.0%ni, 50.5%id, 42.5%wa,  0.0%hi,  0.3%si,  0.0%st
    Mem:   3088492k total,  2619440k used,   469052k free,   238536k buffers
    Swap:  4104188k total,        0k used,  4104188k free,  1769788k cached
    

    Both say that zero swap is actually being used.

    I'm using a 64bit capable core2 duo dell laptop with 4gigs of ram running 32bit ubuntu precise on a persistent live USB stick.

    I may be answering my own question but I wonder if the liveUSB stick nature of the environment is somehow related...

    Let me know if you need more information.

    • Admin
      Admin almost 12 years
      Why do you want to use swap?.. it's only going to slow things down...
    • Admin
      Admin almost 12 years
      I've never seen my system use any swap file at all (I also have 4 GB).
    • Admin
      Admin almost 12 years
      @UriHerrera, I wanted to put it on a separate drive because I thought it was already being used but .... it appears that it was never being used in the first place and everything was being loaded into ram.... I don't get though why it was so slow. ... I since then moved my .cache and .mozilla folders to a separate drive creating sym links for them and that seems to make things a lot snappier.. don't know why the screen dims when I have 4gigs of ram and no swap being used on a core 2 duo O_o
  • Forty-Two
    Forty-Two almost 12 years
    The thing is, if swap is not being used than I shouldn't be seeing slowness. But I'm getting a lot of seemingly memory related slowness. You know when unity/compiz effects dim the screen from memory overload... but if it is all in ram than things should be snappy... so swap must be getting used.... no?
  • BlitZz
    BlitZz almost 12 years
    If swap is not being used, then it's not memory related. You can try turning off swap temporarily to see how things feel(sudo swapoff -a), or play with "swappiness" which decides how much your system will use the swap file (askubuntu.com/questions/103915/how-do-i-configure-swappines‌​s).