Analyzer thread-stack-loaded
Name
thread-stack-loaded - Loaded stack memory used by all the threads
This analyzer examines thread stack memory allocation by inspecting the internal stack management structures in glibc’s dynamic linker (ld) and pthread library. The analyzer reports two key metrics:
- “Total allocated”: The total size of stack memory allocated by pthread for threads
- “Total loaded”: The actual stack memory that has been touched/faulted into physical memory This helps identify memory waste from over-allocated thread stacks and understand the gap between reserved virtual memory and actual physical memory usage. It’s particularly useful for applications with many threads where stack over-provisioning can lead to significant memory overhead.
Resource Category
Memory.
Application Type & Technical Stack
- All
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 thread-stack-loaded -p PID
# trace a shell command directly
orxray analyzer run thread-stack-loaded -c SHELL_CMD
# PGID is the process group ID or any process's PID within the target process
# group.
orxray analyzer run thread-stack-loaded -p -PGID
# trace any processes started from the specified executable path.
orxray analyzer run thread-stack-loaded --exe /path/to/exe/file
Tracing Multiple Processes
Supported.
Output Formats
- Plain Texts
Output Example
[
{
"series": {
"data": {
"Total loaded": 24576,
"Total allocated": 135168
},
"name": "Memory Size (bytes)"
},
"type": "bar",
"subtitle": "pid: 1021",
"title": "Thread stack's allocated memory vs loaded memory"
}
]
Author
The OpenResty Inc. Team.
Copyright
Copyright (C) by OpenResty Inc. All rights reserved.