Analyzer lj-mem-realloc-distr
Name
lj-mem-realloc-distr - Lua Memory Realloc Size Distribution
This analyzer monitors memory allocation and reallocation size distribution in LuaJIT-based applications such as OpenResty and Kong. It captures both new GC object allocations and memory reallocation events, tracking the target sizes being allocated. The histogram shows the distribution of allocation sizes, helping identify memory usage patterns and potential optimization opportunities in Lua memory management.
Resource Category
Memory.
Application Type & Technical Stack
- OpenResty
- Kong
- APISIX
Command Line Syntax
The analyzer can be invoked directly on the command-line via the orxray
utility from the openresty-xray-cli software package.
Alternatively, the analyzer can also be invoked manually or automatically on the web console UI of OpenResty XRay (like on the Advanced web page).
# PID is the target process PID.
orxray analyzer run lj-mem-realloc-distr -p PID
# trace a shell command directly
orxray analyzer run lj-mem-realloc-distr -c SHELL_CMD
# PGID is the process group ID or any process's PID within the target process
# group.
orxray analyzer run lj-mem-realloc-distr -p -PGID
# trace any processes started from the specified executable path.
orxray analyzer run lj-mem-realloc-distr --exe /path/to/exe/file
Tracing Multiple Processes
Supported.
Output Formats
- Histogram Bar Charts
- Plain Texts
Output Example
{
"data": [{
"title": "Lua Memory Reallocation Size Distribution",
"subtitle": "337 Calls (min: 24 bytes, avg: 426 bytes, max: 3072 bytes)",
"type": "dist-bar",
"ver": 1,
"series": {
"data": {
"4": 0, "8": 0, "16": 28, "32": 105, "64": 130, "128": 20,
"256": 12, "512": 4, "1024": 0, "2048": 38, "4096": 0, "8192": 0
},
"categoryUnit": "bytes",
"categoryTitle": "Memory Size",
"name": "Calls"
},
"summary": {"avg": 426, "max": 3072, "min": 24, "cnt": 337},
"kind": "lj-mem-realloc-distr"
}],
"kind": "common"
}
Author
The OpenResty Inc. Team.
Copyright
Copyright (C) by OpenResty Inc. All rights reserved.