I am using GCD to get memory pressure notifications.
GCD documentation describes some constants like so:
DISPATCH_MEMORYPRESSURE_WARN
The system memory pressure condition is at the warning stage. Apps should release memory that they do not need right now.
DISPATCH_MEMORYPRESSURE_CRITICAL
The system memory pressure condition is at the critical stage. Apps should release as much memory as possible.
Seems logical that I should free unused memory. However, in other places (man pages and source code) I find this note related to these constants:
Elevated memory pressure is a system-wide condition that applications registered for this source should react to by changing their future memory use behavior, e.g. by reducing cache sizes of newly initiated operations until memory pressure returns back to normal.
However, applications should NOT traverse and discard existing caches for past operations when the system system tem memory pressure enters an elevated state, as that is likely to trigger VM operations that will further further ther aggravate system memory pressure.
This confuses me. So should I free memory, or should I just stop allocating new memory?