Analyzer lj-gco-cdata-fin

Name

lj-gco-cdata-fin - CData Object Statistics by Finalizer

This analyzer collects statistics on CData objects grouped by their finalizer functions in LuaJIT-based applications such as OpenResty and Kong. It tracks the count of CData objects associated with each finalizer, helping identify memory usage patterns and potential memory leaks related to CData objects. The analyzer provides insights into how CData objects are being managed and cleaned up through their finalizers.

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-gco-cdata-fin -p PID

# trace a shell command directly
orxray analyzer run lj-gco-cdata-fin -c SHELL_CMD

Tracing Multiple Processes

Not supported.

Output Formats

  • Tables
  • Plain Texts

Output Example

[
  {
    "data": [
      ["Finilizer", "CData Count"],
      // Regex pattern objects used in ngx.re.* APIs
      ["ngx_http_lua_ffi_destroy_regex", "369"],
      // Unknown finalizer - may indicate third-party library or custom CData
      ["0x7f70647a1dc0", "180"],
      // SSL private key objects from ngx.ssl module
      ["ngx_http_lua_ffi_free_priv_key", "80"],
      // SSL certificate objects from ngx.ssl module
      ["ngx_http_lua_ffi_free_cert", "80"],
      // Unknown finalizers - possibly from lua-resty-* libraries
      ["0x7f70649db970", "60"],
      ["0x7f6eed802920", "58"],
      ["0x7f6eed807a60", "44"],
      ["0x7f6ed522b7b0", "13"],
      // Semaphore objects from ngx.semaphore module
      ["ngx_http_lua_ffi_sema_gc", "2"],
      ["0x7f7030e163d0", "2"],
      // Access log handler objects
      ["ngx_http_lua_conf_ffi_destroy_access_log", "1"],
      ["0x7f706490c8a0", "1"],
      ["0x7f70649c6760", "1"],
      // Custom log handler objects
      ["ngx_http_lua_conf_ffi_destroy_clog", "1"],
      // Script engine instances
      ["ngx_http_lua_ffi_destroy_script_engine", "1"],
      ["0x7f70649c5990", "1"]
    ],
    "title": "",
    "type": "table",
    "ver": 1
  }
]

Author

The OpenResty Inc. Team.

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