diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2009-12-21 13:24:58 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2009-12-21 13:24:58 +0000 |
commit | dfdef2d253ff46286f705e5112b55967467452bf (patch) | |
tree | c6ef28ddd15e68a157fc8221e4132dfef91c9006 | |
parent | d2de03fc1b9f519da27fb340458b69802f9f0dc6 (diff) |
if we're not in a "pretend" mode, synchronization operations on vstat occur
after the files have been committed to the file system, so we can forget about
them...
I don't know where I lost that change, restores pkg_add memory usage to very
small values...
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/AddDelete.pm | 7 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Vstat.pm | 7 |
2 files changed, 9 insertions, 5 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm index 90844010398..6b68c467a38 100644 --- a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm +++ b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: AddDelete.pm,v 1.10 2009/12/21 10:38:58 espie Exp $ +# $OpenBSD: AddDelete.pm,v 1.11 2009/12/21 13:24:57 espie Exp $ # # Copyright (c) 2007-2009 Marc Espie <espie@openbsd.org> # @@ -47,6 +47,7 @@ sub handle_options $opt_n = 1; } $state->{not} = $opt_n; + $state->vstat->{not} = $opt_n; # XXX RequiredBy $main::not = $opt_n; $state->{defines} = \%defines; @@ -181,8 +182,8 @@ sub tally sub synchronize { - shift; - &OpenBSD::Vstat::synchronize; + my $self = shift; + OpenBSD::Vstat::synchronize($self->{not}); } package OpenBSD::Log; diff --git a/usr.sbin/pkg_add/OpenBSD/Vstat.pm b/usr.sbin/pkg_add/OpenBSD/Vstat.pm index c5011bad5ab..58334efac3f 100644 --- a/usr.sbin/pkg_add/OpenBSD/Vstat.pm +++ b/usr.sbin/pkg_add/OpenBSD/Vstat.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Vstat.pm,v 1.45 2009/12/20 22:38:45 espie Exp $ +# $OpenBSD: Vstat.pm,v 1.46 2009/12/21 13:24:57 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -30,7 +30,7 @@ use OpenBSD::Paths; my $devinfo = {}; my $devinfo2 = {}; -my $virtual = {}; +our $virtual = {}; my $giveup; sub create_device($) @@ -154,10 +154,13 @@ sub account_later($$) sub synchronize { + my $not = shift; while (my ($k, $v) = each %$devinfo) { $v->{used} += $v->{delayed}; $v->{delayed} = 0; } + # Grab back all memory if we can ! + $virtual = {} unless $not; } sub add($$;$) |