Skip to content
DiagnosticsReferenceNew · 0.744

getluauheapusage

Read aggregate memory accounted for by the current Luau VM.

Aliasesgetluaheapusage

Details#

Combines the VM's whole-kilobyte memory counter with its remaining-byte counter and returns a byte count. This reads current accounting; it does not force a garbage-collection cycle.

Signature#

Luau
getluauheapusage(): number

Returns#

A nonnegative number of bytes. A negative combined counter is clamped to 0.

Examples#

Display a memory reading in KiB

Luau
local bytes = getluauheapusage()
assert(type(bytes) == "number" and bytes >= 0)
print(string.format("Luau memory: %.1f KiB", bytes / 1024))

Notes#

  • The result is in bytes and can change between calls.