Analyzer c-memory

Name

c-memory - C Application-Level Memory Usage Breakdown

This analyzer provides a comprehensive breakdown of memory usage at the application level for C-based applications. It monitors memory allocations across different memory regions including glibc arenas, mmap regions, executable segments, stack space, and shared libraries. The analyzer generates pie charts visualizing memory distribution across these categories, helping identify memory consumption patterns and potential memory management issues. This is essential for understanding overall memory footprint and optimizing memory usage 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-memory -p PID

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

Tracing Multiple Processes

Not supported.

Output Formats

  • Pie Charts
  • Plain Texts

Output Example

[
  {
      "title": "C Application-Level Memory Usage Breakdown",
      "subtitle": "pid: 197576, allocator: glibc, (including unloaded memory)",
      "type": "pie",
      "id": "",
      "series": {
          "data": {
              "vm_lib": 12464128,
              "vm_exe": 2113536,
              "vm_stack": 135168,
              "vm_file": 52666368,
              "Allocator.total": 89374720
          },
          "name": "Size",
          "valueUnit": "B"
      },
      "ver": 1,
      "kind": "c-memory"
  },
  {
      "title": "Glibc Allocator Memory Usage Breakdown",
      "subtitle": "pid: 197576",
      "type": "pie",
      "id": "",
      "series": {
          "data": {
              "Glibc-arena.brk": 43945984,
              "Glibc-arena.mmap": 0,
              "Glibc-mmaped": 45428736
          },
          "name": "Size",
          "valueUnit": "B"
      },
      "ver": 1,
      "kind": "glibc-allocator"
  }
]

Author

The OpenResty Inc. Team.

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