For example, Linux has vm.overcommit_memory which is on by default. Windows does not have memory overcommit. Does MacOS? Is it configurable? What's the default setting?
Asked
Active
Viewed 2,229 times
1 Answers
4
I've tested on my MacOS and it's working. I use code from this question. And system allow me allocate more then 40Gb memory, with only 16Gb RAM onboard and 6Gb used swap(on picture process of allocation before OOM-killer execution).
My kernel version is:
Darwin AT-MacBook-Pro-2.local 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar 3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64
I don't found possibility to configure overcommit, but look like by default it 2. But we should remember, that MacOS have dynamic swap and it compress memory, so my assumption could be wrong.
Alexander Tolkachev
- 4,638
-
What happens if you start writing data on the allocated area? Just writing one number (e.g. page counter) every 4 KB should require actual pages to be reserved and then you can see what really happens. On linux OOM Killer would step in and kill the process taking most RAM. – Mikko Rantalainen Apr 28 '20 at 10:01
-
Can I overcommit on FreeBSD as well? – Nick Jul 15 '22 at 07:34
-
@Nick, yes you can. – Alexander Tolkachev Jul 18 '22 at 19:55
