I couldn’t give you any detail but I saw on another (closed) forum that someone made a RAM disk with RAMdiskcreator tool, to leave 8GB outside the RAM disk, for the same reason.Is there a way to reliably limit MacOS to 8GB on a MacBook Air that has more? It would let me experience 8GB.
That won't work. First, the RAM Disk does not consume RAM unless it has been written to. Even if it has, the OS will compress the RAM disk's memory and eventually swap it out to give you back the full 16GB of RAM.someone made a RAM disk with RAMdiskcreator tool, to leave 8GB outside the RAM disk
Is there a way to reliably limit MacOS to 8GB on a MacBook Air that has more? It would let me experience 8GB.
That won't work. First, the RAM Disk does not consume RAM unless it has been written to. Even if it has, the OS will compress the RAM disk's memory and eventually swap it out to give you back the full 16GB of RAM.
Yea, RAM disk must be filled up to consume its allocated memory space. If the RAM disk has open files that are active the memory management will leave it alone and not compress it. No matter, another way to do this is to use Terminal and the memory_pressure command to reserve space and hold onto to it for a specified amount of time so one can test the Mac with a reduced memory footprint for user. See below... I found this to be acceptable for testing on my M3 Ultra Studio leaving just about 8GB of memory for me to test over a period of 1hr.That won't work. First, the RAM Disk does not consume RAM unless it has been written to. Even if it has, the OS will compress the RAM disk's memory and eventually swap it out to give you back the full 16GB of RAM.
I now have my Neo and can compare its actual memory management with the Terminal's Apple provided memory_pressure program use on my M3 Ultra Studio to configure just 8GB of memory for it. Yea, the M3 Ultra has many more cores than the Neo where both are running with the 8GB memory, so the M3 Ultra will perform better with its 8GB compared to the Neo with its 8GB memory. My focus doing the testing on the M3 Ultra is to monitor the memory pressure that Activity Monitor provides.The examples I've seen of people trying generally lead to a worse perception than that from people who actually have 8GB machines. Some of it might be a bias due to people capable of hacking their machine in that way having higher expectations than people who buy base hardware or hold onto old equipment, but I also think it indicates that the methods used aren't reliable.
MacOS is very sophisticated in how it manages resources and I don't think it responds well to kludgy modifications.
It is the same if you pin the physical pages in memory to prevent them from being compressed or paged out.What some people do is to create something which uses 8Gb of memory, but it's not the same.
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
int main()
{
size_t size = 1073741824;
void *ptr = malloc(size);
if (!ptr) {
fputs("malloc failed\n", stderr);
return 1;
}
int res = mlock(ptr, size);
if (res) {
fputs("mlock failed\n", stderr);
return 1;
}
fputs("memory allocated and locked\npress ctrl-c to quit\n", stderr);
while (1) {
sleep(3600);
}
return 0;
}
Yes, that is another way for sure but requires one to write a program to malloc() and lock the memory allocation requested.Write a C program that uses malloc() to allocate memory followed by mlock() to pin the pages which prevents them from being compressed or paged out.
Thanks for that... appreciated.👍Just compile this and run in terminal after changing the size to how much memory you want to "remove" from the system.
C:#include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <sys/mman.h> int main() { size_t size = 1073741824; void *ptr = malloc(size); if (!ptr) { fputs("malloc failed\n", stderr); return 1; } int res = mlock(ptr, size); if (res) { fputs("mlock failed\n", stderr); return 1; } fputs("memory allocated and locked\npress ctrl-c to quit\n", stderr); while (1) { sleep(3600); } return 0; }