[SCM] Debian package checker branch, master, updated. 2.5.0-rc2-144-g7e3e4fa
The following commit has been merged in the master branch:
commit c5880b0fadd3fed72adf9f91f1032bc89c6596c4
Author: Niels Thykier <niels@thykier.net>
Date: Tue Apr 19 14:09:50 2011 +0200
Throw away info objects when checks are done
This avoids memory being used by info-caches that will never be
used again. This are thrown out when the entire group has been
processed.
diff --git a/frontend/lintian b/frontend/lintian
index ff73cc7..1fff26e 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -1037,7 +1037,10 @@ my %overrides;
foreach my $gname (sort $pool->get_group_names()) {
my $group = $pool->get_group($gname);
unpack_group($group);
- process_group($group) if $action eq 'check';
+ if ($action eq 'check'){
+ process_group($group);
+ clear_group_cache($group);
+ }
}
$TAGS->file_end();
@@ -1528,6 +1531,18 @@ sub process_group {
return 1;
}
+
+# cleans the cache of all elements in this group - this avoids
+# memory being hogged by packages/groups that have been checked
+# and will not be checked again.
+sub clear_group_cache {
+ my ($group) = @_;
+ foreach my $proc ($group->get_processables()){
+ $proc->clear_cache;
+ }
+ return 1;
+}
+
# }}}
# {{{ Exit handler.
diff --git a/lib/Lintian/Processable.pm b/lib/Lintian/Processable.pm
index 5fd4948..21ba8a2 100644
--- a/lib/Lintian/Processable.pm
+++ b/lib/Lintian/Processable.pm
@@ -144,6 +144,18 @@ sub info{
return $info;
}
+=item $proc->clear_cache()
+
+Discard the info element, so the memory used by it can be reclaimed.
+Mostly useful when checking a lot of packages (e.g. on lintian.d.o).
+
+=cut
+
+sub clear_cache {
+ my ($self) = @_;
+ delete $self->{info};
+}
+
=item $proc->lab_pkg([$lpkg])
Returns or sets the L<Lab::Package|$info> element for this processable.
--
Debian package checker
Reply to: