Created
June 4, 2010 11:40
-
-
Save DaveMessina/425309 to your computer and use it in GitHub Desktop.
get memory size of a data structure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# $Id$ | |
# created by Dave Messina on 2010-04-28 | |
use Modern::Perl; | |
use Devel::Size qw(total_size); | |
my %hash; | |
say "Empty: ", total_size (\%hash), ' bytes'; | |
foreach my $number (1..100000) { | |
my $key = 1 . $number; | |
$hash{$key} = 1; | |
} | |
say "Full: ", total_size (\%hash), ' bytes'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment