{
my $foo = {}; # ref count 1
$foo->{foo} = $foo; # ref count 2
} ### $foo goes out of scope here, memory should be released to perl
# here, $foo is not addressable (you can't refer to it by $foo),
# but its memory is not released until exit
# because there is still a reference to $foo
# it refers to it self, its self-referential, a circular reference
# for memory held by $foo to be released after $foo goes out of scope
# $foo->{foo} has to be weakened, the reference count decreased