MemInfo(3)

πŸ’– NAME πŸ’–

Sys::MemInfo β€” query the total free and used physical memory. πŸ’…

Okay so this is the MemInfo(3) page from the User Contributed Perl Documentation section, and it’s all about asking your system how much memory is doing what. 🫢


✨ SYNOPSIS ✨

use Sys::MemInfo qw(totalmem freemem totalswap);

print "total memory: ".(&totalmem / 1024)."\n";
print "free memory:  ".(&freemem / 1024)."\n";

print "total swap: ".(&totalswap / 1024)."\n";
print "free swap:  ".(Sys::MemInfo::get("freeswap") / 1024)."\n";

Like, literally copy that energy, bestie. The ampersand calls are exactly as written. πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

So Sys::MemInfo returns the total amount of free and used physical memory in bytes in the totalmem and freemem variables. πŸ’–

The total amount of free and user swap memory also comes back in the totalswap and freeswap variables. ✨

The vibe check has passed on these: it’s been tested on Linux 3.13.0, UnixWare 7.1.2, AIX5, OpenBSD 3.8, NetBSD 2.0.2, FreBSD 5.4, HPUX11, Solaris 9, Tru64 5.1, Irix 6.5, Mac OS X 10.2 darwin and Windows XP. πŸ§ͺ🌸

It should work on FreeBSD 4 and Windows 9X/ME/NT/200X/Vista. Fingers crossed, bestie. πŸ€žπŸ’œ


🧚 METHODS 🧚

πŸ”‘ availkeys

Returns a list of all accessor keys (freemem, totalmem, etc.). This is useful for dumping out all known information from the object by calling get() on all of the returned keys. πŸ—‚οΈβœ¨

πŸ’– freemem

Returns free physical memory in bytes. πŸ’Ύ

πŸ¦‹ freeswap

Returns free swap space in bytes. 🌸

πŸŽ€ get

Returns the value of the passed key. πŸ”‘

πŸ‘‘ totalmem

Returns total physical memory size in bytes. πŸ’…

⭐ totalswap

Returns total swap space in bytes. ✨


πŸ’Œ AUTHOR πŸ’Œ

By Sylvain Cresto <scresto@gmail.com> 🫢

Thanks to Laurent Dufour and Wilson Snyder. You guys ate. πŸ’–


πŸ› BUGS πŸ›

Please send bug-reports to scresto@gmail.com β€” don’t be shy, bestie. πŸ“¬πŸ›


🌈 LICENCE 🌈

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. πŸ’–βœ¨


Copyright (C) 2005, 2006, 2014, 2016 - Sylvain Cresto πŸ‘‘


mwah πŸ’‹ this page is from perl v5.42.0, dated 2020-11-24 β€” bye bestie! πŸ¦‹βœ¨

πŸ“¦ where this page comes from