#!/usr/bin/env perl use strict; use warnings; use Devel::Size qw(total_size); my(@o, @h); print "Total starting size for \@o: ", total_size(\@o), "\n"; print "Total starting size for \@h: ", total_size(\@h), "\n"; for (1..100000) { push @o, bless {}, 'Foo'; } for (1..100000) { push @h, {}; } print "Total ending size for \@o: ", total_size(\@o), "\n"; print "Total ending size for \@h: ", total_size(\@h), "\n"; #### Total starting size for @o: 64 Total starting size for @h: 64 Total ending size for @o: 15246272 Total ending size for @h: 15246272 #### #!/usr/bin/env perl use strict; use warnings; use Devel::Peek; my $o = bless {}, 'Foo'; my $o2 = bless {}, 'Foo'; my $h = {}; Dump($o); Dump($o2); Dump($h); #### SV = IV(0x1e03ee8) at 0x1e03ef8 REFCNT = 1 FLAGS = (ROK) RV = 0x1de0358 SV = PVHV(0x1de5b70) at 0x1de0358 REFCNT = 1 FLAGS = (OBJECT,SHAREKEYS) STASH = 0x1dfa948 "Foo" ARRAY = 0x0 KEYS = 0 FILL = 0 MAX = 7 SV = IV(0x1e03e40) at 0x1e03e50 REFCNT = 1 FLAGS = (ROK) RV = 0x1de0508 SV = PVHV(0x1de60d0) at 0x1de0508 REFCNT = 1 FLAGS = (OBJECT,SHAREKEYS) STASH = 0x1dfa948 "Foo" ARRAY = 0x0 KEYS = 0 FILL = 0 MAX = 7 SV = IV(0x1e03e58) at 0x1e03e68 REFCNT = 1 FLAGS = (ROK) RV = 0x1dfa990 SV = PVHV(0x1de6130) at 0x1dfa990 REFCNT = 1 FLAGS = (SHAREKEYS) ARRAY = 0x0 KEYS = 0 FILL = 0 MAX = 7