RAM filled by mp3's


Forum: Other Help Topics
Topic: RAM filled by mp3's
started by: tempestuous

Posted by tempestuous on April 26 2005,06:43
I run a remastered/customised version of DSL from HD as a "Poor Man's Install".  This allows me to use the "toram" boot parameter, then suspend my hard drive at the end of bootup so my laptop is quieter and I get an extra 30 minutes battery life.
At the end of bootup "free" shows my RAM usage as 98,700 kB, of 128,000 available.

Here's the problem - if I choose to listen to music (which I access from CompactFlash), each mp3 file continues to fill up the RAM cache, so that about 6 songs later I'm out of RAM and my hard drive spins up to use the swap file.
This is the same with all playback applications - XMMS, mpg321, and MPlayer.
Even streaming mp3's from the internet fill up the cache.

But here's the interesting part - if I playback CD audio tracks in XMMS, there's no RAM bloat.
But I don't want to play my music from CD, because I have one of those ultra-compact laptops where the CD drive is a separate unit connected by PCMCIA.

A Google search indicates that Linux wants to cache everything accessed from a mounted filesystem.
Audio CD's are, of course, not mounted.

Does anyone know how I might prevent my music files from filling up the RAM cache?

Craig S

Posted by tempestuous on April 30 2005,14:07
For anyone interested, I found the answer ... sort of.
I just add the "noswap" boot parameter, and without a swap partition available Linux reclaims part of the RAM cache as free RAM runs out.
In my case, this starts to happen with about 2500 kB of RAM remaining.  Then as I continue to play more MP3's I can see the free RAM fluctuating between about 2500 kB and 3500 kB.

Initially I was nervous using the "noswap" boot option, because I seem to remember trying this some time ago with the result that my laptop "froze" and required a hard reboot when I ran out of RAM.  I can't recall what my configuration was at the time.  Perhaps "noswap" only works OK when used in conjunction with "toram"?
Anyway, it's working great and I'm happy.

Posted by mikshaw on April 30 2005,14:50
I assume some applications handle ram differently than others, and some apps continue to write until they can't write anymore.  Take Firefox for example.  If its cache is set to 50mb it will continue to write to that cache until it uses 50mb.  If you don't have 50mb of free ram for the Firefox cache, the RAM will get used up.  Since this is a file cache the system will not free it up automatically....it will smother.
Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.