useAppMemoryMonitor

Returns a reactive accessor for the memory warnings the runtime reports for the app

import { useAppMemoryMonitor } from "@roku-sdk/runtime/app-memory-monitor";
const useAppMemoryMonitor: () => { memoryWarning: Accessor<MemoryStatus | null> } & Record<string, never>

Description

Returns a reactive accessor for the memory warnings the runtime reports for the app.

memoryWarning is null until the first warning arrives, then holds the latest MemoryStatus, whose memoryUsagePercent is the share of the app's memory limit in use. Use it to free caches or reduce work when memory runs low. Call the hook inside a component; the warning handler is removed when the last component using it is cleaned up. For one-off memory queries, use getAppMemoryMonitor.


What’s Next

Did this page help you?