Analyzer c-count-alloc-free

Name

c-count-alloc-free - C Application-Level Memory API Calls

This analyzer tracks and counts memory allocation and deallocation API calls in C-based applications. It monitors calls to malloc, calloc, realloc, free, and related memory management functions. The analyzer provides statistics on allocation counts. This is valuable for identifying excessive memory operations, detecting potential memory leaks through imbalanced allocation/deallocation ratios, and understanding memory management behavior in C applications.

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-count-alloc-free -p PID

# trace a shell command directly
orxray analyzer run c-count-alloc-free -c SHELL_CMD

Tracing Multiple Processes

Not supported.

Output Formats

  • Plain Texts

Output Example

[
  {
      "title": "C Application-Level Memory API Calls",
      "subtitle": "",
      "series": {
          "data": {
              "free": 509,
              "malloc": 491
          },
          "name": "Calls"
      },
      "ver": 1,
      "type": "bar"
  }
]

Author

The OpenResty Inc. Team.

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