SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2013-03-26 04:04:08

lcafiero
The #! Guy
From: Felton, California, USA
Registered: 2011-07-21
Posts: 2,225
Website

[SOLVED/ANSWERED] Observation/Question about swap allotment

Hey, all -- This isn't really a question to be solved as much as question spawned from an observation, asked in curiosity about swap allotment by those who would know this far more about this than I do (which isn't really saying much, in this department).

After looking around for anything that addresses this particular situation, I really didn't see anything, hence I'm posting it here (and since it's not specifically a "help" question, I didn't put it under Help and Support, though if my mod colleagues think it should go there, I have no objection to it being moved).

Yesterday, I was watching a couple of episodes of "The Newsroom" and the frame froze in VLC after about two hours. Reducing the window, I noticed that the Swap Usage in Conky was at 7.8GB when there was 7.68GB allotted. Hmmm, that's odd (or maybe not). I rebooted and that seemed to have solved that.

Today I was watching "Men in Black" off a DVD on VLC when I noticed toward the end of the film that the swap usage surpassed the alloted 7.68GB of Swap Usage, but the RAM was at something like 680MiB/3.72GiB or thereabouts. Hmmm again, that's odd.

The performance wasn't affected on the second time, and I shut down VLC and a couple of other things that were running -- noticing, of course, that the Swap Usage remained the same -- and then took a look around for an answer. I did find a way to clear the Swap Usage from the command line, using

# swapoff -a && swapon -a

but I'm just wondering -- a.) why would the swap be used when there's still memory that's not yet being used (in the case of the "Men in Black" video where less than 700MB was used), and b.) when the swap is used, does it stay "occupied" (for lack of a better term) even when the assumed program(s) using it are shut down?

Again, it's just something about which I'm curious.


Res publica non dominetur | Larry the CrunchBang Guy speaks of the pompetous of CrunchBang

CrunchBang Forum moderator

Offline

Help fund CrunchBang, donate to the project!

#2 2013-03-26 04:19:31

VastOne
#! Ranger
From: V-Ger
Registered: 2011-04-26
Posts: 10,165
Website

Re: [SOLVED/ANSWERED] Observation/Question about swap allotment

Interesting... I wonder if this is a VLC issue more than anything else.  I just recently spent an entire day watching several movies back to back to back in UMPlayer and never saw any spikes in any memory.  Just the load of the movie playing and nothing more.

Good questions...


VSIDO | Words That Build Or Destroy

I dev VSIDO

Offline

#3 2013-03-26 04:27:36

lcafiero
The #! Guy
From: Felton, California, USA
Registered: 2011-07-21
Posts: 2,225
Website

Re: [SOLVED/ANSWERED] Observation/Question about swap allotment

Yeah, it could very well be a VLC issue (he says, heading over to their forum to see if it has occurred), but it makes one wonder.


Res publica non dominetur | Larry the CrunchBang Guy speaks of the pompetous of CrunchBang

CrunchBang Forum moderator

Offline

#4 2013-03-26 06:45:18

el_koraco
#!/loony/bun
From: inside Ed
Registered: 2011-07-25
Posts: 4,749

Re: [SOLVED/ANSWERED] Observation/Question about swap allotment

VLC is known for various types of memory leaks, so I'm not surprised.

Offline

#5 2013-03-26 07:27:23

gutterslob
#! Resident Bum
Registered: 2009-11-03
Posts: 3,207

Re: [SOLVED/ANSWERED] Observation/Question about swap allotment

Not using VLC here, so this is just a hunch at best.

What does this give you?

cat /proc/sys/vm/swappiness

If it gave you a value like 60 or something (I think this was default for the old Stable Debian), try setting a lower value with:

echo 10 > /proc/sys/vm/swappiness

or you can even set it to zero with:

echo 0 > /proc/sys/vm/swappiness

Now try VLC again with whatever video/file you had the problem with earlier.
If you don't see heavy swapping any longer, then make the changes permanent by editing your /etc/sysctl.conf and changing the line related to vm.swappiness (should be at the end). Then reboot.

Note that this is not actually fixing VLC, but just telling the OS to swap less aggressively. Like I said earlier, I have no experience with VLC.

You could also check what's happening with VLC by running top or htop. It could be that VLC has somehow decided to run multiple instances of itself. You could also play with nice values and see how VLC responds.

Last edited by gutterslob (2013-03-26 07:27:54)


Point & Squirt

Offline

#6 2013-03-26 13:22:29

CBizgreat!
#! Die Hard
Registered: 2011-07-27
Posts: 1,865

Re: [SOLVED/ANSWERED] Observation/Question about swap allotment

Slob-san beat me to it ...

One reason why I've long since become a fan of lowering swappiness in /etc/sysctl.conf like here.

Even w 6gbs of ddr3, still lower my swappiness anyway. Doesn't make sense to me ... to use disk + the dreaded disk i/o that surely comes with it ... When someone has plenty of free RAM still available. The default of vm.swappiness=60 is silly imo. Have seen it mentioned several times that people with over 2gbs of RAM can feel good in lowering swappiness to 0, whereas others suggesting people in that situation set swappiness to 20 or 30, have always stuck to vm.swappiness=10 meself. Haven't seen swap ever used on this system as of yet. Worked great on the crusty low spec 512mb ddr2 nix box ( ALMOST never saw swap being used on it either, as a result of lowering swappiness.) and it's what I'm sticking to on this higher spec box too.

Also note ... that while I standby this nix tweak myself and see absolutely no reason why adjusting swappiness is a bad idea high or low. Am in no way absolving VLC as it could be a contributor in the very least regardless. One of the gazillion virtues of gnu/nix ... You most likely NEVER, EVER ... have a shortage of alternatives/options.


Vll! smile

Last edited by CBizgreat! (2013-03-26 13:27:17)


Some common cbiz abbreviations. This will save me time and yet @ same time tell folks what the babble is supposed to mean.

Vll ! = ( Viva la gnu/Linux !)    Vl#!! = ( Viva la #! !)    Last but not least, UD ... OD ! = ( Use Debian ... or die !) tongue

Offline

#7 2013-03-26 14:44:31

lcafiero
The #! Guy
From: Felton, California, USA
Registered: 2011-07-21
Posts: 2,225
Website

Re: [SOLVED/ANSWERED] Observation/Question about swap allotment

Thanks, all -- excellent insights.

gutterslob -- I neglected to mention that I used htop and killed the processes for VLC (there were four), and it didn't put a dent in the already overfilled swap. I even reset Conky to see if it was stuck, and the number stayed where it was at rather than going down. Maybe that's the way it's set up to work, which is fine, but I thought it was strange. (by the way, my swappiness is 60, and I may change that -- thanks for the tip).

el_koraco -- Yeah, reading the VLC forums later showed there was a huge memory leak debate/issue and, interestingly, it preceded what seemed to be a reluctance to fix it, reading some of the bug reports.

CBizgreat! -- True, there are a lot of alternatives out there, and like VastOne suggests, I'll also see if the same thing happens on UMPlayer. Choice is good.

Also, it should be noted (and I didn't earlier -- sorry) that the hardware is a Toshiba Satellite T455, a 64-bit behemoth with 4GB RAM and a 320GB hard drive -- the most powerful piece of hardware I've ever owned (it was saved from utter doom when my workplace was shipping it off to be recycled and I said, "Wait. Can I have this?"). I don't normally watch videos on my laptop, but I thought I'd put this hardware through some paces I wouldn't normally do with my ThinkPads.

Thanks again, all, for the help here.


Res publica non dominetur | Larry the CrunchBang Guy speaks of the pompetous of CrunchBang

CrunchBang Forum moderator

Offline

#8 2013-03-26 15:23:37

dura
Bloated Gimp
From: interzone
Registered: 2012-09-15
Posts: 2,108

Re: [SOLVED/ANSWERED] Observation/Question about swap allotment

There's also a difference between memory which is in use and memory that is in the buffers or whatever. What is shown via conky or free -h as used is not entirely occupied by processes but instead in the buffers. Mine shows loads used, but it seems most of it is in buffers.

➜  ~  free -h
             total       used       free     shared    buffers     cached
Mem:          2.9G       1.4G       1.5G         0B        51M       468M
-/+ buffers/cache:       876M       2.0G
Swap:           0B         0B         0B

Why don't you just swapoff and not mount it back on? Is there any point to it in this situation?

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo