For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt, and this page is available as Markdown at /next/api/lynx-native-api/lynx-env/trim-memory.md.
Lynx
  • English
  • trimMemory

    Dispatches a memory pressure signal to registered callbacks. Use this to notify Lynx to reclaim resources or apply degradation strategies when the system is under memory pressure.

    Syntax

    Android

    @AnyThread
    public void trimMemory(@MemoryPressureLevel int pressure);

    iOS

    - (void)trimMemory:(LynxMemoryPressureLevel)pressure;

    Harmony

    public trimMemory(pressure: MemoryPressureLevel): void;

    Parameters

    • pressure: Memory pressure level, one of MemoryPressureLevel.
      • MEMORY_PRESSURE_LEVEL_NONE: No problems, enough memory; typically not sent via callback.
      • MEMORY_PRESSURE_LEVEL_MODERATE: Free buffers that are cheap to re-allocate and not immediately needed.
      • MEMORY_PRESSURE_LEVEL_CRITICAL: Free all possible memory; otherwise the process may be killed by the system, incurring cold start cost.

    Compatibility

    LCD tables only load in the browser

    Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.