Test2:...emUsage(3pm)

πŸ’– Test2:...emUsage β€” like, the manual page bestie πŸ’–

okay so this is Test2::Plugin::MemUsage(3pm) from the User Contributed Perl Documentation, and I'm gonna walk you through it like we're texting at 2am. grab a snack. πŸ“


✨ NAME ✨

Test2::Plugin::MemUsage β€” Collect and display memory usage information. that's it, that's the whole vibe. πŸ‘‘


🌈 PLATFORM SUPPORT 🌈

so the plugin is lowkey an overachiever and it picks a memory collector based on $^O. different platforms, different strategies, no cap:

  • Linux, Cygwin, GNU/kFreeBSD β€” it reads /proc/PID/status. it reports rss, size (VmSize), and peak (VmPeak). three for three, slay. πŸ’…
  • macOS (darwin), *BSD, Solaris, AIX, HP-UX β€” it shells out to ps -o rss=,vsz= -p $$. it reports rss and size; peak is NA unless BSD::Resource is installed (see below bestie, I gotchu). 😭
  • MSWin32 β€” it uses Win32::Process::Memory if installed to call GetProcessMemoryInfo. it reports rss (WorkingSetSize), peak (PeakWorkingSetSize), and size (PagefileUsage). Windows eating good. πŸͺŸβœ¨
  • Other / fallback β€” if BSD::Resource is installed, getrusage is used to fill in a peak RSS value when the primary collector did not provide one (or when no native collector matched the platform at all). it's giving backup dancer energy. πŸ•Ί

and if no collector and no fallback applies? the plugin is a silent no-op. literally says nothing. ghosted you fr fr. πŸ’€


πŸ¦‹ DESCRIPTION πŸ¦‹

This plugin will collect memory usage info from /proc/PID/status and display it for you when the test is done running. that's the whole thing. it just vibe-checks your memory and reports back like a good little bestie. 🫢


πŸŽ€ SYNOPSIS πŸŽ€

use Test2::Plugin::MemUsage;

This is also useful at the command line for 1-time use:

$ perl -MTest2::Plugin::MemUsage path/to/test.t

Output:

# rss:  36708kB
# size: 49836kB
# peak: 49836kB

okay but the output is so clean?? rss, size, peak, all lined up. main character formatting honestly. πŸ”₯


🌸 SOURCE 🌸

The source code repository for Test2-Plugin-MemUsage can be found at https://github.com/Test-More/Test2-Plugin-MemUsage/. go lurk, it's fine, we all do it. πŸ™ˆ


πŸ‘‘ MAINTAINERS πŸ‘‘

  • Chad Granum <exodist@cpan.org>

⭐ AUTHORS ⭐

  • Chad Granum <exodist@cpan.org>

(yes bestie, the maintainer and the author are the same icon. king behavior.) πŸ‘‘


Copyright 2019 Chad Granum <exodist@cpan.org>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://dev.perl.org/licenses/


no cap, that's the entire page. every flag-ish thing, every path, every platform, every name β€” all accounted for. nothing skipped, nothing invented. periodt. πŸ’…

and that's the tea, bestie β€” this was perl v5.40.1, dated 2026-05-06, and I hope your memory usage stays iconic forever. mwah. πŸŽ€βœ¨πŸ¦‹πŸ’–

πŸ“¦ where this page comes from