30 Aug 2022 14:43:33 UTC
- Distribution: Devel-MAT
- Module version: 0.48
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (8)
- Testers (235 / 37 / 5)
- KwaliteeBus factor: 1
- 55.56% Coverage
- License: perl_5
- Perl: v5.14.0
- Download (137.2KB)
- MetaCPAN Explorer
- Subscribe to distribution
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- This version
- Latest version++ed by:14 non-PAUSE users
- SV METHODS
Devel::MAT::Tool::Sizes- calculate sizes of SV structures
Devel::MATtool calculates the sizes of the structures around SVs. The individual size of each individual SV is given by the
sizemethod, though in several cases SVs can be considered to be part of larger structures of a combined aggregate size. This tool calculates those sizes and adds them to the UI.
The structural size is calculated from the basic size of the SV, added to which for various types is:
Arrays add the basic size of every non-mortal element SV.
Hashes add the basic size of every non-mortal value SV.
Codes add the basic size of their padlist and constant value, and all their padnames, pads, constants and globrefs.
The owned size is calculated by starting at the given SV and accumulating the set of every strong outref whose refcount is 1. This is the set of all SVs the original directly owns.
This tool adds the following SV methods.
@svs = $sv->structure_set
Returns the total set of the SV's structure.
$size = $sv->structure_size
Returns the size, in bytes, of the structure that the SV contains.
@svs = $sv->owned_set
Returns the set of every SV owned by the given one.
$size = $sv->owned_size
Returns the total size, in bytes, of the SVs owned by the given one.
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
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.
If counting sizes in a way that includes referred SVs, a tree is printed showing the 3 largest SVs within these, and of those the 2 largest referred SVs again. This should help identify large memory occupiers.
Takes the following named options:
By default, only the individual SV size is counted.
Paul Evans <firstname.lastname@example.org>
|s||Focus search bar|
|?||Bring up this help dialog|
|g p||Go to pull requests|
|g i||go to github issues (only if github is preferred repository)|
|g a||Go to author|
|g c||Go to changes|
|g i||Go to issues|
|g d||Go to dist|
|g r||Go to repository/SCM|
|g s||Go to source|
|g b||Go to file browse|