Devel:...::Sizes(3pm)
π Devel::MAT::Tool::Sizes(3pm) β the sizes era β¨
okay bestie, sit down, hydrate, because we're talking about the Devel::MAT::Tool::Sizes page from the User Contributed Perl Documentation π
this one is literally the girl who counts things.
πΈ NAME πΈ
Devel::MAT::Tool::Sizes β calculate sizes of SV structures π§
π¦ DESCRIPTION π¦
So, this Devel::MAT tool does the math on how big the structures around SVs actually are. The size of each lil individual SV? That's the size method's whole job. But heeere's the tea: in a bunch of cases, SVs are lowkey part of bigger structures that have a combined aggregate size π«Ά This tool figures out those sizes and yeets them into the UI. iconic.
The structural size starts from the basic size of the SV, and then for various types it adds stuff on top:
- ARRAY β arrays add the basic size of every non-mortal element SV β¨
- HASH β hashes add the basic size of every non-mortal value SV π
- CODE β codes add the basic size of their padlist and constant value, plus all their padnames, pads, constants and globrefs π
And the owned size? That one's calculated by starting at the given SV and accumulating the set of every strong outref whose refcount is 1. That's the set of all SVs the original directly owns, no cap. π
π SV METHODS π
This tool is so generous, bestie, it adds these SV methods:
π structure_set
@svs = $sv->structure_set;
Returns the total set of the SV's structure π¦
π structure_size
$size = $sv->structure_size;
Returns the size, in bytes, of the structure that the SV contains π
π owned_set
@svs = $sv->owned_set;
Returns the set of every SV owned by the given one π«Ά
π owned_size
$size = $sv->owned_size;
Returns the total size, in bytes, of the SVs owned by the given one π
π₯ COMMANDS π₯
π size
Prints the sizes of a given SV β¨
pmat> size defstash
STASH(61) at 0x556e47243e10=defstash consumes:
2.1 KiB directly
11.2 KiB structurally
54.2 KiB including owned referrants
π largest
pmat> largest -owned
STASH(61) at 0x55e4317dfe10: 54.2 KiB: of which
| GLOB(%*) at 0x55e43180be60: 16.9 KiB: of which
| | STASH(40) at 0x55e43180bdd0: 16.7 KiB
| | GLOB(&*) at 0x55e4318ad330: 2.8 KiB
| | others: 15.0 KiB
| GLOB(%*) at 0x55e4317fdf28: 4.1 KiB: of which
| | STASH(34) at 0x55e4317fdf40: 4.0 KiB bytes
...
Finds and prints the largest SVs by size π The 5 largest SVs are shown, periodt.
And if you're counting sizes in a way that includes referred SVs? Then a tree gets printed showing the 3 largest SVs within these, and of those the 2 largest referred SVs again π³ This should help you identify the big memory occupiers, bestie, the ones holding all the vibes hostage.
It takes the following named options:
--structβ count SVs using the structural size π--ownedβ count SVs using the owned size π
By default, only the individual SV size is counted β
π AUTHOR π
Paul Evans <leonerd@leonerd.org.uk> β thank you king π«‘
and that's the whole page, babe π
signed off from perl v5.42.3, dated 2026-08-21, still serving Devel:...::Sizes(3pm) realness β¨ππ
π¦ 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