how to disable virtual memory of mac os

Hello,

I use mac os v10.5.8 and my macbook has 4G mem. After the computer runs for one week, I always see about 2G data is swapped to the disk. I don't know why so much memory is needed. I think I have enough physical memory for most of time, so I want to disable virtual memory and see how fast my system can run. but I cannot find where I can disable virtual memory. Could anyone please tell me how to do it?

Zheng Da

Macbook, Mac OS X (10.5.8)

Posted on Apr 8, 2010 7:51 PM

Reply
10 replies

Apr 8, 2010 9:06 PM in response to icoming

You do not want to disable VM. Use Activity Monitor to keep track of your computer's memory usage. Most likely you are misunderstanding what you see or think is going on. The amount of data swapped may have nothing to do with how much RAM you have.

About OS X Memory Management and Usage

Reading system memory usage in Activity Monitor
Memory Management in Mac OS X
Performance Guidelines- Memory Management in Mac OS X
A detailed look at memory usage in OS X

Understanding top output in the Terminal

The amount of available RAM for applications is the sum of Free RAM and Inactive RAM. This will change as applications are opened and closed or change from active to inactive status. The Swap figure represents an estimate of the total amount of swap space required for VM if used, but does not necessarily indicate the actual size of the existing swap file. If you are really in need of more RAM that would be indicated by how frequently the system uses VM. If you open the Terminal and run the top command at the prompt you will find information reported on Pageins () and Pageouts (). Pageouts () is the important figure. If the value in the parentheses is 0 (zero) then OS X is not making instantaneous use of VM which means you have adequate physical RAM for the system with the applications you have loaded. If the figure in parentheses is running positive and your hard drive is constantly being used (thrashing) then you need more physical RAM.

Apr 8, 2010 9:47 PM in response to Kappy

I'll run my computer for a while to see the number of pageouts. It may take one or two days.

But I'm pretty sure virtual memory is used. For example, after running firefox for a long time, it takes me a while to close it as some of its data is swapped to the disk and somehow firefox needs to access it.

Also I have a problem that my machine cannot be reboot and shutdown after running one or two weeks. I think it has something to do with virtual memory. So I want to try disabling virtual memory.

Apr 9, 2010 12:36 AM in response to icoming

Firefox is just a slower browser, especially for launching & shutting down. In my experience, that's just the way the browser is.

Could you elaborate on what you mean by "cannot reboot or shutdown after one or two weeks"?

Does the computer hang during the shutdown, or is it just slow to shutdown? If the latter, how slow?

~Lyssa

Apr 9, 2010 2:03 AM in response to Lyssa

It's not just firefox. some other large applications have the same problem after they run for a few days. If I open firefox and close it in a few minutes, there isn't such a problem. I think the reason is that some data of firefox (or other large applications) is swapped to the disk.

I believe the computer hangs during shutdown because I have waited for almost half an hour. It shouldn't take so a long time to shutdown a computer. Sometimes the computer has closed Finder and I can only see the background and the cursor, but it seems the computer stops there forever. Sometimes Finder is still there after I try to shutdown the computer, but I cannot open any applications.

Some people say that the problem is caused by some background programs. Maybe. but it's difficult for me to find out the program.

Apr 9, 2010 6:32 AM in response to icoming

But I'm pretty sure virtual memory is used. For example, after running firefox for a long time, it takes me a while to close it as some of its data is swapped to the disk and somehow firefox needs to access it.

You are confusing virtual memory with paging and swapping. Virtual memory is an essential part of the operating system. It gives the OS the ability to use any random 4K chunks (pages) of memory with any program. That is to say, VM means the OS can grab a bunch of available pages and create a range of virtual addresses that a program can use. Before VM, it was extremely difficult to manage physical memory.

Paging and swapping are a way of pretending you have more physical memory than is physically installed in the system. Before virtual memory there was just swapping of an entire program out of memory. With virtual memory it is possible to just page out parts of a program.

It is the paging and swapping that is annoying you, not virtual memory. An operating system without virtual memory is called DOS 🙂
Also I have a problem that my machine cannot be reboot and shutdown after running one or two weeks. I think it has something to do with virtual memory. So I want to try disabling virtual memory.

Neither virtual memory nor paging would affect your ability to shutdown or reboot.

You have something else going on.

Have you by any chance installed some intrusive 3rd party software, such as an anti-virus utility?

Apr 9, 2010 8:00 AM in response to BobHarris

I guess you are right. Virtual memory means virtual memory space in contrast to physical memory space. Swapping is a more accurate term for this. But Windows uses the term virtual memory to address the space in the disk where the data in the physical memory can be swapped to, so I thought it won't cause so much confusion.

Message was edited by: icoming

Apr 9, 2010 10:10 AM in response to icoming

What is the capacity of your hard drive and how much space is free?

As noted above, the page-swapping is an integral function of the Mac OS. But it in order to do it successfully, the OS needs free space on the hard drive. Keeping less than 15% space free at any time can make the OS run slow and potentially lead to corruption and damage in your disk directory.

Apr 9, 2010 11:19 AM in response to Jay Bullock

I still have 92 GB free space on the disk and the total space is about 230GB. So it shouldn't be a problem.

It's kind of strange thought that Mac OS cannot disable swapping. All other OSes I used such as Windows and Linux can disable it.

Since I have known the answer to my original question, I guess it's better to close the question and start another thread to discuss why my system cannot be shutdown after running for a long time. Thank you.

Message was edited by: icoming

Message was edited by: icoming

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

how to disable virtual memory of mac os

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.