get_dangling_references

omni.ext.get_dangling_references(who, frame_depth_to_ignore: int = 0, full_details: bool = False) str

Returns a string containing debugging information about dangling references on an object.

Different levels of detail will be provided based on the environment variable “GC_DEBUG”, provided by the two methods _get_dangling_references_shallow() and _get_dangling_references_deep().

This is a tool that is useful for tracking down Python object leaks when an extension is unloaded and reloaded, to ensure you are properly cleaning up when the extension shuts down. You can insert calls to this in various locations of your code where you suspect objects are left dangling.

That code is open for improvement to figure out more info on who holds an object. For instance It can go recursively up the tree to get more info on who holds what.

Parameters
  • who – Object to check for referrers in the garbage collector

  • frame_depth_to_ignore – Number of frames above this one deemed irrelevant to the leak detector e.g. the caller, a wrapper function invoking the caller, etc.

  • full_details – If True then add the very verbose _builtins, _globals, and _locals information

Returns

String containing a multi-line description of the references that remain on the object