Killing Mac OS X Swapping : How To Disable dynamic_pager
If like me you cannot deal with the swapping in OS X, and if you have tried everything possible, even not to launch dynamic_pager (and you've seen that you're system is not usable anymore (on my mac the 2Gb was detected but the system was refusing to use more then 1Gb Actually, the original source code of dynamic_pager can be found at http://www.opensource.apple.com/darwinsource/10.5.2/system_cmds-433/dynamic_pager.tproj/dynamic_pager.c. You will need an apple developper account (that's free) do download it. If you know how to compile this, please add a comment to this post. After a bit of hacking, (removing cryptic junk, calls to private code of the kernel that is not accessible for the public, hacks to make it compile and commented a macx_swapon call), here is the modified dynamic_pager.c. Once you downloaded it it can be compiled by using this awful command : gcc -o dynamic_pager -no-cpp-precomp -DNO_DIRECT_RPC -framework CoreFoundation -framework IOKit -lSystem.B -R -DNO_DIRECT_RPC dynamic_pager.c -I/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers -I/Developer/SDKs/MacOSX10.4u.sdk/usr/includeThen (after having done a backup of the regular dynamic_pager) copy your brand new dynamic_pager to /sbin. Reboot and enjoy : it will only create a single swap file (64Mb), no less, no more. I'm currently running it and it seems to work really fine. All my memory is used, not only the first 1Gb. The Inactive Memory is high as usual, but the single swap file is only marginally used. The code posted above is just a big hack, when I will have more time I will clean up the code so that it will be a bit more understandable. Enjoy.
Comments (9)
:: Trackbacks (2)
Trackbacks
links for 2008-04-03
cestdelamerde.com (tags: fun humour) old story about going to greenland (tags: greenland vacances) Killing Mac OS X Swapping : How To Disable dynamic_pager - cestdelamerde.com Very good hack to improve how swapping is handeld in leopard. (tags: macintosh memory...
Weblog: Ludovic's weblog
Tracked: Apr 03, 07:36
Mac OS X Leopard - dynamic_pager ?????
Mac OS X 10.5.1 Leopard ?????????? OS X ??????????swapping. ??????????????????????????
Weblog: 404 Blog Not Found
Tracked: Aug 24, 23:57 Comments
Display comments as
(Linear | Threaded)
Philou - could you also post some diffs ?
No, but you can do the diff by yourself if you have the original dynamic_pager.c file
I'm currently testing another version of this hack to completely disable paging : in my current dynamic_pager.c file, there is no reference to macosx_swapon() anymore - it seems to work pretty well.
Heya, first of all, I'm also "suffering" like U about all this "prehistoric" way of managing modern resources and more specifically memory and HDD access.
I've implemented U'r hack, and for now I'm so excited as a little boy about to open a christmas present...in deed it is. I've posted many rants and hacks in my blog (in Spanish) about how IT should manage the menory and all this, and I completly share U'r thoughts! I'm interested in the last hack U implemented, the explanation and how it fared, and maybe if it is available... I also have some more thoughts about how memory management SHOULD be implemented for ACTUAL times, so hit me up by email when U have time CIAO! CeK!
You can download the diff here : http://cestdelamerde.com/uploads/dynamic-pager.diff
s/^No/I do not have access to my mac and I will not have time to post the diff until next week/
Hi and thx again!
I've been experimenting, and doing some (quite) harsh things to my poor MBP 3GB... I've modified the dynamic_pager on my own, and no swap is generated. The system just FLYS!!! Need to do some more experimenting and maybe try and fuse the 2 versions. The idea behind is that once you overwhelm the system's memory, and before just crashing the system (coz of out of memory), the dynamic_pager starts swapping automagically. when I have some free time I'll try to write this and do some more experiments, and hopefully let U know :p Thx again for being the pioneer! CIAO! CeK!
Thanks for the great hack. In spite of 4GB RAM I started getting swaps (maybe having too much fun w/ VMWare Fusion).
I wrote a Makefle to automate that. It fetches and build Universal Binary dynamic_pager. "make install" backs up the original. http://www.dan.co.jp/cases/macosx/leopard/hacked_dynamic_pager/Makefile.txt Hope you like it. Dan the Leopard Tamer |
QuicksearchArchivesCategoriesSyndicate This Blog |
Powered by s9y
