81

/var/vm/sleepimage is used to store the contents of the RAM during hibernation, and the hybrid hibernation and sleep mode that Mac laptops use by default. If you have 8 GiB of RAM, /var/vm/sleepimage takes about 8 GiB of disk space. I don't know why it isn't deleted after waking up from sleep though. It might be to ensure that there is enough free disk space ...


25

swapfile0, swapfile1 and so on are swap files. You can sort of think of them like "backup" RAM. When your computer doesn't have enough RAM to accomodate the memory requests of all your programs (which is almost always, this is normal), it uses these files to "write out" part of what it had in RAM. The sleepimage has a very similar use, except it's used only ...


24

Addition: What Dan Barrett said about the sleepimage re-creation is true. However there's a way to get around it and therefore permanently free the disk space occupied by sleepimage. The whole steps: disable hibernation mode: sudo pmset -a hibernatemode 0 delete /private/var/vm/sleepimage: sudo rm /private/var/vm/sleepimage create an empty file and ...


24

This inconvenience is caused by a finder prefs entry: "show in new window: all my files" this is consuming too much mem. Select a different folder and all is fine


17

Apple documents the lowest levels of the Mach Kernel and the virtual memory subsystem fairly well on the web as part of it's developer documentation. Kernel Programming Guide: Memory and Virtual Memory Since that kernel was developed by Carnegie Mellon University, you can find dozens of papers describing it quite easily. If that is too low level for your ...


13

Memory Pressure is a better indicator of the health of the virtual memory system than the traditional UNIX measure of free, inactive and active pages. For a brush up on the previous measure, have a read at: Isn't Inactive memory a waste of resources? Now, the caching of files is drawn as a good thing (green memory pressure) and you will only see the ...


12

According to Accessing Kernel Memory on the x86 Version of Mac OS X, /dev/mem and /dev/kmem were removed when Apple released OS X for Intel processors. The (excellent) article also explains how to reenable the memory devices, namely using the kmem=1 kernel boot argument. Note that, as commented below by neal, in macOS 10.15 Catalina (and probably since ...


11

They are virtual and cost nothing to make. The VM hands out space to each program that asks for any but leaves tons of room to grow between each real allocation. These virtual addresses get mapped into the real RAM space as needed and mapped out when they are freed or otherwise inactive. They can even get paged to your storage if needed. You can reboot to ...


10

I recently answered a question like yours, so thought I'd restate the major points for you, in case this is still a problem. Mac OS X allocates and uses RAM differently than most versions of MS Windows and can be confusing at times. Microsoft originally built Windows to keep as much memory free as possible. Apple's memory model follows a guideline that ...


10

I can't say much about preventing this, but there is no need to reboot. Just kill Finder, using Force Quit from the apple menu or killall Finder in a Terminal window. A new Finder will then be started in the old one's place.


10

This wonderful Apple Support article says it all: https://support.apple.com/en-us/HT201464#memory I'll give the short version here: There are three different types of memory, as you have noticed - wired, app, and compressed. Each of these types do something slightly different. Wired memory Wired memory refers to memory that cannot be taken out from RAM. ...


8

I've been researching this very question for some time, and I've come to the conclusion that while there are several so-called "solutions" offered in various places, none of them really fixes the problem or makes the symptoms go away. The best I've found is techniques that change when inactive memory is swapped, such as the use of the purge command you ...


8

You seem to misunderstand virtual memory. Virtual memory is simply a mechanism that the OS uses to make it look like each program has its own, extremely large (4GB on 32-bit, 16 EB on 64-bit) address space. It also provides a way for the OS to use paging, all while making it look like (to applications) only real RAM is being used. In short, it's only an ...


8

Looking at your memory usage you don't need more RAM. To answer your questions: Apps may open faster if you are running lots of heavy duty apps, like Photoshop, Xcode, etc… I doubt you'd see much of an increase in the FPS in games. That depends on the video card and how well the game is written. Overall performance increase would probably be minimal. The ...


7

I had the same problem when I installed High Sierra on external SSD. Volume disk3s4 647DA4A9-7E85-4523-A4D2-F0392D3789D4 --------------------------------------------------- APFS Volume Disk (Role): disk3s4 (VM) Name: VM (Case-insensitive) Mount Point: Not Mounted Capacity Consumed: ...


7

Boot up in Recovery mode and use the Terminal to remove the swapfile0 file. That is fully safe to do.


6

This happens because of a change that happened within the High Sierra versions. It is unknown whether this is a bug, or simply a change of hearts at Apple, but with High Sierra the location of the swapfile was changed from /private/var/vm to /vm, and then in a later update to High Sierra moved back to /privat/var/vm. The best way to proceed is to ensure ...


5

Just throwing in my 2 cents for those who wish to disable swap BECAUSE of small SSDs: the sleepimage uses far more disk space. And, for those concerned about the limited life of the SSD (particularly those with MBA's and hard-wired SSD chips that CANNOT be replaced), if your computer sleeps many times per day, the rewriting of the sleepimage may be a ...


5

How much RAM does your Mac have? Also, browsers (especially Webkit ones) are known to use huge amounts of memory these days. Inactive memory is put to good use opposed to free RAM which just sits there consuming power. In the case of a browser this enables you to undo closing a tab and still have it's history preserved, etc. You can completely disable ...


5

Photoshop takes 70% of your RAM by default when it starts. Whether it's a 2G RAM or 64G RAM machine, Photoshop grabs 70% of the RAM. When calculating how much space Photoshop is wanting for files. look at the document sizes in the lower-left. I believe the second number is how large the file is when open. That can be a much different size than the first ...


5

Here are some ways to check for issues but I fear they may not be a complete or even the correct solution without more peeking or poking: In another shell after you start your python process (or if you screen / tmux it): df / top -l 1 -S | head -12 vm_stat and vm_stat 600 sudo du -sm /var/vm/* Once you have a good baseline, you can watch things over time ...


5

The memory in the 2019 MBP (two Thunderbolt 3 ports) is soldered to the motherboard, and is not user-upgradeable.


4

I have been unable to establish a permanent system boot solution, since 10.10 no longer uses /etc/.rc at boot, and the com.apple.dynamic_pager.plist method has failed.... however... sudo mkdir /Volumes/Swap/s sudo chmod 755 /Volumes/Swap/s sudo sysctl vm.swapfileprefix=/Volumes/Swap/s does change the stored prefix as reported by sysctl vm for the ...


4

Don't remove /private/var/vm it is your swap files which the OS constantly uses. When you need less swap or you reboot the OS will reduce the number of files it uses here.


4

Yes you can configure the dynamic_pager, but for most it is simpler to just disable it and see which program crashes due to the inevitable out of memory errors. Why would I disable swap file in Mac OS X? Pay attention to programs that implement their own virtual memory / cache / paging systems like virtualization and the Adobe Suite in case you have ...


4

To re-create swap files, you should restart the Mac (a normal shutdown is all that's needed). Swap files get cleaned up each and every reboot whether you attempted to mess with them or not. I used the word attempted since you can't really delete a swap file from under the system due to how unix (the underpinnings of Mac OS X) works. The best you can do is ...


4

I think I got it to work on macOS Sierra! I downloaded comex's project: Kmem Project I compiled the kext, fixed the permissions and then loaded it! Using terminal I went into /dev and ls showed both mem and kmem... Edit: If you download the project you will just need to change the compiler in Xcode to use the latest ( for example... I don't know if other ...


4

I'm not completely certain of the FREEZER options, other than one FREEZER_COMPRESSOR option uses swap (utilizes free space on a disk) when RAM is low or expended, while the other does not. What I think is that the FREEZER options are for managing memory for frozen processes. Maybe this is something experimental, to be used in combination with App Nap? I ...


4

vm_stat may just show you what you need. As per the man page: vm_stat -- show Mach virtual memory statistics It can show you the following: Pages free Pages active Pages inactive Pages speculative Pages throttled Pages wired down Pages purgeable "Translation faults" Pages copy-on-write Pages zero filled Pages reactivated Pages purged File-backed pages ...


4

I would run the sysdiagnose command to generate snapshots on both systems. It's going to log far more data than you need, but it will show memory maps of why exactly the memory allocation has gotten to the place where it is. Then, if you set up two test accounts on each Mac with nothing in them - set both to be the auto-log-in user and reboot both. Grab a ...


Only top voted, non community-wiki answers of a minimum length are eligible