Mercurial > pub > Impl
comparison Lib/IMPL/Profiler/Memory.pm @ 190:cd1ff7029a63
IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
author | cin |
---|---|
date | Wed, 04 Apr 2012 17:51:27 +0400 |
parents | 08015e2803f1 |
children | 4d0e1962161c |
comparison
equal
deleted
inserted
replaced
189:08015e2803f1 | 190:cd1ff7029a63 |
---|---|
55 use parent qw(IMPL::Object::Fields); | 55 use parent qw(IMPL::Object::Fields); |
56 | 56 |
57 use Data::Dumper(); | 57 use Data::Dumper(); |
58 use Scalar::Util qw(refaddr weaken isweak); | 58 use Scalar::Util qw(refaddr weaken isweak); |
59 | 59 |
60 use fields qw( objects ); | 60 use fields qw( objects counter); |
61 | 61 |
62 sub CTOR { | 62 sub CTOR { |
63 my $this = shift; | 63 my $this = shift; |
64 $this->{objects} = []; | 64 $this->{objects} = []; |
65 $this->{counter} = 0; | |
65 } | 66 } |
66 | 67 |
67 sub track { | 68 sub track { |
68 my $i = scalar @{$_[0]->{objects}}; | 69 my $i = scalar @{$_[0]->{objects}}; |
69 $_[0]->{objects}[$i] = $_[1]; | 70 $_[0]->{objects}[$i] = $_[1]; |
70 weaken($_[0]->{objects}[$i]); | 71 weaken($_[0]->{objects}[$i]); |
72 $_[0]->{counter} ++; | |
71 } | 73 } |
72 | 74 |
73 sub Purge { | 75 sub Purge { |
74 my $this = shift; | 76 my $this = shift; |
75 | 77 |