RAM swap disk possible?

Posted:
in Mac Software edited January 2014
I've read that OS X uses an 80M swap disk. Is it possible to use 80 meg of your ram for this?

Comments

  • Reply 1 of 10
    adpowersadpowers Posts: 188member
    Umm, why would you want to? It seems like you would rather just use the 80 MB of extra RAM to store programs in memory than use that memory for swap space which would cause more programs to be swapped. Using this as swap space would also have more overhead than just plain memory. Reminds of the quote:



    "Cool, virtual memory! Now we can have really large RAM drives!"
  • Reply 2 of 10
    sc_marktsc_markt Posts: 1,401member
    [quote]Originally posted by adpowers:

    <strong>Umm, why would you want to? It seems like you would rather just use the 80 MB of extra RAM to store programs in memory than use that memory for swap space which would cause more programs to be swapped. Using this as swap space would also have more overhead than just plain memory. </strong><hr></blockquote>



    Well, I've been reading that some people's swap files are not being deleted correctly. Seems to me that using a ram swap drive would solve that problem. And, wouldn't it be faster if a ram swap file was used instead of the Hard drive?
  • Reply 3 of 10
    airslufairsluf Posts: 1,861member
  • Reply 4 of 10
    buonrottobuonrotto Posts: 6,368member
    As I understand it, OS X's memory management will cache anything it can to RAM (that's why it's so RAM hungry), and then start to swap off anything that either doesn't fit or hasn't been used in a while to the hard disk. So if you add RAM to your setup, you will in effect create a larger RAM swap disk anyway. I'm not expert though, I could be wrong about that.
  • Reply 5 of 10
    sc_marktsc_markt Posts: 1,401member
    Thanks AirSlurf and BuonRotto for your responses...
  • Reply 6 of 10
    costiquecostique Posts: 1,084member
    MacOS X is UNIX and its virtual memory mechanism is essential and indispensable. You cannot turn it off in OS X. The only way to minimize swapping is to install more RAM and the only effective way to increase swapping speed is to get a faster HD (yes, you can use another HD for that purpose).

    Since MacOS X prefers RAM until it's full, this is exactly what RAM disks were for when we had a bad VM system. Now it's built into the kernel and apart from further optimizing the kernel we cannot invent anything more efficient.

    Type ls -l /var/vm/ and you'll see several 80MB (well, 80 000 000 bytes) files. Only one at start-up. If I understand it correctly, these are the memory pages swapped out (so-called page-outs) by the system. The less RAM your apps use, the less files you see there. I never noticed until recently that MacOS X is actually able to delete them when they are no longer needed. I used to think they persist until a restart. As for these files not being deleted at shutdown, I suspect there must be a permission error preventing the system from deleting them.
  • Reply 7 of 10
    airslufairsluf Posts: 1,861member
  • Reply 8 of 10
    1337_5l4xx0r1337_5l4xx0r Posts: 1,558member
    Hmmm. This goes a ways toward explaing the hard disk thrashing that occurs on my PBG4 867/1GB RAM every startup. Top also says that all sorts of stuff has been swapped out... immediatly after boot up!



    Very strange.



    But yes, in response to the query, what you really want to do is purchase and install more ram.



    The equation for ram amounts is like so:



    more(ram) = better
  • Reply 9 of 10
    Ugh. This reminds me of when I worked in an Architecture computer lab on campus. Now don't get me wrong, architects are usually far more computer savvy than the typical user. However, there was one guy (I never found out who though) who would set up 1GB ram disks on computers with 128MB physical ram. What's worse, he would leave these things mounted after he was finished. "Cannot launch program because there is not enough RAM. Please increase blah blah blah blah" messages would come up all the time.
  • Reply 10 of 10
    airslufairsluf Posts: 1,861member
Sign In or Register to comment.