File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,10 @@ class MemoryMonitorDarwin : public MemoryMonitor {
3333 DISPATCH_SOURCE_TYPE_MEMORYPRESSURE,
3434 0 , // system-wide monitoring
3535 DISPATCH_MEMORYPRESSURE_WARN | DISPATCH_MEMORYPRESSURE_CRITICAL,
36- dispatch_get_main_queue ());
36+ dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0 ));
37+
38+ if (!m_memory_pressure_source)
39+ return ;
3740
3841 dispatch_source_set_event_handler (m_memory_pressure_source, ^{
3942 dispatch_source_memorypressure_flags_t pressureLevel =
@@ -45,7 +48,12 @@ class MemoryMonitorDarwin : public MemoryMonitor {
4548 });
4649 }
4750
48- void Stop () override { dispatch_source_cancel (m_memory_pressure_source); }
51+ void Stop () override {
52+ if (m_memory_pressure_source) {
53+ dispatch_source_cancel (m_memory_pressure_source);
54+ dispatch_release (m_memory_pressure_source);
55+ }
56+ }
4957
5058private:
5159 dispatch_source_t m_memory_pressure_source;
You can’t perform that action at this time.
0 commit comments