Skip to main content

Get current memory usage (app.used_memory)

Declaration

mem = app.used_memory(bid_or_pid)

Parameters

  • bid_or_pid
    String (bundle id) or Integer (pid).

Returns

  • mem
    Number | nil. Memory usage in MB if the app is running, otherwise nil.

Example

local qqmem = app.used_memory("com.tencent.mqq")
sys.alert("QQ memory usage: "..qqmem.." MB")

Note: uses non-chapter API sys.alert.