Catching memory crashes

Questions and Answers about all things *OS (macOS, iOS, tvOS, watchOS)

Re: Catching memory crashes

Postby septium » Mon Nov 19, 2018 3:12 pm

Honestly I don't know for sure. It's worth experimenting. Just my guess: if NOTE_VM_PRESSURE_SUDDEN_TERMINATE kevent'ing would work in sandboxed, non-entitled, non-platform process — everyone would've already used it to catch OOMs because veeery many developers want it and seek for this capability.

PS. Sorry for too confident skeptical tones :)
septium
 
Posts: 39
Joined: Thu May 04, 2017 10:04 am

Re: Catching memory crashes

Postby cahoots » Mon Nov 19, 2018 3:30 pm

That is my fear as well septium, I just don't know if the code I posted in my second post in this thread isn't working because Apple won't allow it or because I'm doing something wrong with this tricky API. Could you take a look yourself?
cahoots
 
Posts: 10
Joined: Mon Oct 08, 2018 3:56 pm

Re: Catching memory crashes

Postby cahoots » Thu Nov 22, 2018 4:44 am

From looking at the XNU source code, it appears that EVFILT_VM hasn't been supported since around Sierra. I wonder if this part in the book was just carried over from the first edition without being checked.
cahoots
 
Posts: 10
Joined: Mon Oct 08, 2018 3:56 pm

Re: Catching memory crashes

Postby septium » Fri Nov 23, 2018 8:07 pm

Seems that deprecation is the real reason. Waiting for real authority reply (J's one) if it's possible to overcome that limitation...
septium
 
Posts: 39
Joined: Thu May 04, 2017 10:04 am

Re: Catching memory crashes

Postby morpheus » Fri Nov 23, 2018 9:43 pm

You're absolutely right. They didn't note it's deprecated , they just removed the case handling silently while leaving it in the headers. #%$#%$#%.
It's hard for me to keep up with all the mechanisms, (I started Volume I back around 10.10..). But yeah, it's gone now.

You can still use vm_pressure_monitor (#296) though that's not on a per process basis. I'll have to research this a bit more. DISPATCH_SOURCE_TYPE_MEMORYPRESSURE still seems to be working (I'll need to verify), and that's effectively the same effect as the NOTE_VM had.


Making a note of this in the next release of the book, updated changelog - thanks, guys!


J
morpheus
Site Admin
 
Posts: 716
Joined: Thu Apr 11, 2013 6:24 pm

Previous

Return to Questions and Answers

Who is online

Users browsing this forum: No registered users and 5 guests