Devel::MAT(3pm)
π Devel::MAT π
okay bestie, welcome to Devel::MAT β the Perl Memory Analysis Tool β from your favorite section of the User Contributed Perl Documentation (that's Devel::MAT(3pm) for the citation girlies πβ¨). this is the page you read when you're the one building stuff on top of it, not the one just using it. let me explain π
π«Ά USER GUIDE
NEW USERS, this is your moment to slow down real quick:
if you're new to the whole Devel::MAT set of tools, this is probably not the document you want to start with. like, at all. if your actual goal is to use Devel::MAT to help diagnose memory-related problems in a perl program, then what you want is the user guide, at Devel::MAT::UserGuide. go there. it's giving β¨guidanceβ¨.
if you're writing tooling modules to extend the abilities of Devel::MAT? then yes bestie, this may indeed be the document for you. read on... π
π DESCRIPTION
a Devel::MAT instance loads a heapdump file, and gives you a container to store analysis tools that work on it. tools may be provided that conform to the Devel::MAT::Tool API β those can help analyse the data, and they can interact with the explorer user interface by using the methods in the Devel::MAT::UI package. iconic behaviour honestly π
πΈ File Format
the dump file format is still under development, so at present no guarantees are made on whether files can be loaded over mismatching versions of Devel::MAT. iykyk, that's the vibe rn.
but!! as of version 0.11 the format should be more extensible, allowing new SV fields to be added without breaking loading β older tools will ignore new fields, and newer tools will just load undef for fields absent in older files. as the distribution approaches maturity the format will be made more stable. we're getting there π¦
β¨ CONSTRUCTOR β¨
π load
$pmat = Devel::MAT->load( $path, %args );
loads a heap dump file from the given path, and returns a new Devel::MAT instance wrapping it. that's it, that's the magic πͺ
π METHODS
π dumpfile
$df = $pmat->dumpfile;
returns the underlying Devel::MAT::Dumpfile instance backing this analysis object. the real one behind the curtain π«£
π§ available_tools
@tools = $pmat->available_tools;
lists the Devel::MAT::Tool classes that are installed and available. window shopping ποΈ
π load_tool
$tool = $pmat->load_tool( $name );
loads the named Devel::MAT::Tool class. come on in bestie, we've been expecting you π
β has_tool
$bool = $pmat->has_tool( $name );
returns true if the named tool is already loaded. vibe check on the tool list β
πΈ run_command
$pmat->run_command( $inv );
runs a tool command given by the Commandable::Invocation instance. just do it π₯
π¦ inref_graph
$node = $pmat->inref_graph( $sv, %opts );
traces the tree of inrefs from $sv back towards the known roots, returning a Devel::MAT::Graph node object representing it, within a graph of reverse references back to the known roots.
this method will load Devel::MAT::Tool::Inrefs if it isn't yet loaded. it's got main character energy, it just shows up π
the following named options are recognised:
depth => INTβ if specified, stop recursing after the specified count. a depth of1will only include immediately referring SVs,2will print the referrers of those, etc. nodes with inrefs that were trimmed because of this limit will appear to be roots with a special name of"EDEPTH". πstrong => BOOLanddirect => BOOLβ specifies the type of inrefs followed. by default all inrefs are followed. passing"strong"will follow only strong direct inrefs. passing"direct"will follow only direct inrefs. choose your fighter π₯elide => BOOLβ if true, attempt to neaten up the output by skipping over certain structures. βοΈREF()-type SVs will be skipped to their referrant.- members of the symbol table will be printed as being a
'root'element of the given symbol name. "PAD"s and"PADLIST"s will be skipped to their referring"CODE", giving shorter output for lexical variables.
π― find_symbol
$sv = $pmat->find_symbol( $name );
attempts to walk the symbol table looking for a symbol of the given name, which must include the sigil. here's the sigil-to-type cheat sheet:
$Package::Name::symbol_name => to return a SCALAR SV
@Package::Name::symbol_name => to return an ARRAY SV
%Package::Name::symbol_name => to return a HASH SV
&Package::Name::symbol_name => to return a CODE SV
pick your sigil, get your SV, slay π
π«§ find_glob
$gv = $pmat->find_glob( $name );
attempts to walk the symbol table looking for a symbol of the given name, returning the "GLOB" object if found. glob hunting expedition, no cap π§
π find_stash
$stash = $pmat->find_stash( $name );
attempts to walk the symbol table looking for a stash of the given name. stash = found, the end π
π AUTHOR
Paul Evans <leonerd@leonerd.org.uk>
and that's a wrap, bestie! this page came to you from perl v5.42.3, dated 2026-08-21 β that's Devel::MAT(3pm), and you can close the tab now. periodt π
β¨π¦
π¦ where this page comes from
- ubuntu stonking: libdevel-mat-perl 0.54-1build1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms