Skip to main content

Module memory_pressure

Module memory_pressure 

Source
Expand description

Memory pressure the platform reports for this process.

Android delivers it through onTrimMemory; other hosts publish their own signal. There is no backlog: pressure describes a moment, so an observer that registers later waits for the next report. Applications collect the stream and give back what they can rebuild — caches, warm model sessions, pools.

Structs§

MemoryPressureObserver
Keeps an observer registered until it is dropped.

Enums§

MemoryPressure
How hard the platform asks for memory back.

Functions§

observe_memory_pressure
Registers observer for pressure reports.
publish_memory_pressure
Publishes a pressure report. Callable from any thread; the framework moves each report onto the UI thread before a composition sees it.
rememberMemoryPressure
Collects pressure reports for as long as this call stays in the composition.