Currently MemoryPressureHandler only stores a single callback lambda. This causes issues with the common pattern of setting the lambda for the singleton MemoryPressureHandler. For instance, all of these callsites do the equivalent of MemoryPressureHandler::singleton().setLowMemoryHandler in the UI process: 1. Legacy WebView init in WebInstallMemoryPressureHandler 2. WebProcessPool init in WebProcessPool::platformInitialize 3. +[NSAttributedString retrieveOrCreateWebview] used by all of the +[NSAttributedString loadFromHTMLWith...] APIs So for instance, if your app creates a WKWebView, and then calls +[NSAttributedString loadFromHTMLWithRequest:options:completionHandler:], then the WebProcessPool low memory handler installed by WKWebView gets overwritten by the NSAttributedString low memory handler, which seems undesirable. There's a FIXME about this in WebProcessPool, so we should probably make it harder to trample on an existing memory pressure handler, or just allow multiple callbacks to be attached to a single memory pressure handler.
<rdar://problem/58484110>