Analyzer c-memory-leak-fgraph

Name

c-memory-leak-fgraph - C-Land Memory Leak Flame Graphs

This analyzer detects and profiles memory leaks in C-land code across all application stacks. It tracks memory allocation and deallocation patterns by monitoring malloc/free operations in libc. The analyzer samples memory allocations during an active period, then enters a silence period accepting only free operations to identify leaked memory. It can filter by chunk size ranges and display results either by allocation count or total allocated size. The analyzer generates flame graphs showing call stacks responsible for memory leaks, helping pinpoint the exact code locations causing memory growth.

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 c-memory-leak-fgraph -p PID

# trace a shell command directly
orxray analyzer run c-memory-leak-fgraph -c SHELL_CMD

# PGID is the process group ID or any process's PID within the target process
# group.
orxray analyzer run c-memory-leak-fgraph -p -PGID

# trace any processes started from the specified executable path.
orxray analyzer run c-memory-leak-fgraph --exe /path/to/exe/file

Tracing Multiple Processes

Supported.

Output Formats

  • Flame Graphs

Author

The OpenResty Inc. Team.

Copyright (C) by OpenResty Inc. All rights reserved.