by varenc · 2w ago · 0 comments
Of course, it would be far better to just not have the memory leak...but in the mean time, macOS memory compression is making the leak nearly a none issue.
0: https://learn.microsoft.com/en-us/archive/msdn-magazine/2009...
APFS on-disk file compression is very mysterious, hard to observe, and harder to intentionally trigger. The only clue in the Finder GUI is comparing the file size vs size on disk. Using the 3rd party `afsctool` you can tell APFS to compress a file on disk manually, but I believe there's no good native macOS way to do this. The official way is that macOS decides for mysterious reasons when to compress a file on disk and it rarely does. But apparently generating a 100GB log file with million of repeated lines is enough to convince macOS to use APFS compression. (and having a disk that's nearly full probably)
edit: looks like `applesauce` is a more modern tool like `afsctool` that lets you use APFS transparent file compression: https://github.com/Dr-Emann/applesauce
a = “ha”
b = 10 * a
c = 10 * b
and so on and watching the memory climb in the activity viewer. I was surprised when the 10GB or even 100GB one (confirmed with len() ) didnt crash my 8GB laptop or even cause it to swap.Interestingly I tried the python version just now on modern macos, currently activity monitor shows 192GB ram used, 184GB compressed, on a machine with 36GB physical.
Actually something really weird happened, zsh killed the python proc, activity monitor shows it still alive, but the physical ram value is bugged and showing 0 bytes physical and 1.7 GB swap. So compressing RAM does have some limitations.
Sure, they will get restarted, but not great.
going through extra effort to accommodate/enable buggy, poorly behaving programs, and meanwhile—
punishing those (and the programmers of those) that are well-behaved and functioning exactly as intended but that now have to contend with evading some heuristic of badness.
So don’t change the OOM descision making, just the action taken.
I think my sibling comment makes a good point though, that this encourages or permits buggy code.
Why not just change Linux's vm.overcommit_memory to not allow overcommitting, so that when a daemon/process does a malloc() an error is returned and it can be handled right away?
Apparently though, tracking pages and access and stuff would be very slow.
I continued thinking about it on how to structure go or jvm apps that you split it in processes so they are more bound to when they are needed and you unload parts of your tool/programm by just handing over the results from one process to the other and kill it.
... but reading say libraries directly and only putting in RAM the parts often used, now we're talking
Apologies for the off-topicness?
—This is in earnest. The brain does operate according to information theory, certainly has memory, and does compress things.
Thus solving memory leaks forever...
I remember RAM Doubler from 1994 doing this.
Fun days.
Now, we find out when the SSD wears out, in the worst case.
Not very long especially on modern consumer SSD. Depending on Drive size, at that speed we are talking about full drive write in ~5 to 10 min. On a 5-year warranty SSD that is about 1 - 2 weeks. We have tested Consumer SSD to last beyond their warranty. But even doubling that would only give you 2 - 4 weeks max.
Came back the next morning and was happy to find that the tests hadn't failed, unfortunately they had also gone far quicker than I had anticipated and had something silly like 2PB written.
Luckily the other half was more than plenty
Give it some time and you'll see numbers you believe was impossible to display on the output of uptime command. (:
Kidding/not kidding.
I've come to regard SSDs as ephemeral. I stripe-RAID them in my workstation to sum their speed as well as their failure rate. (Which actually also distributes the wear, so…)
And then I use the combined speed and terror to kindle the motivational fire of getting a proper backup solution underneath it.
Currently we run some datacenter SSDs which handle constant load just fine, despite being TLCs.
I believe they really put some magic smoke in these chips, because the endurance numbers are just black art at this point. Even my system SSD, which is an EVO860 256GB shows its wear level at 33% after 44K hours.
My /home disk, a 980 Pro 2TB, shows 1% wear after 835 hours. That machine is on 24/7.
A shame it's dead.