From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id DF0141F63E for ; Tue, 31 Jan 2023 00:05:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1675123515; bh=2ZOi/Dc8A/eF9PY1PjlbUMX83Np4CDxXnJ3CiCeKG+k=; h=From:To:Subject:Date:From; b=A6j+kB3z7OqBycVtikl4aKfsj/L0QHDVPi7MzLseMKHJk85cM9TfFDoj1eKuhLLaV /ZF/otkRtCpxS1v491uzrXziInvI06oUguZOXgcQgLu+gZG8t6g9bgp867GvubHk2N /jg6ALMi3Yf3jpKKiDuMHzLBAutFLS9+4HkKaSTk= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] lei: drop -watches and -lei_note_event from workers Date: Tue, 31 Jan 2023 00:05:15 +0000 Message-Id: <20230131000515.3863177-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: I noticed these while tracking down circular refs for commit 7b654d175cf2e31b (ipc: drop awaitpid_init to avoid circular refs, 2023-01-30). While they're not the cause of circular refs, they're still a waste of memory in worker processes. --- lib/PublicInbox/LEI.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index ffd50db5..d05b20de 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -561,17 +561,17 @@ sub note_sigpipe { # triggers sigpipe_handler sub _lei_atfork_child { my ($self, $persist) = @_; # we need to explicitly close things which are on stack + my $cfg = $self->{cfg}; if ($persist) { open $self->{3}, '<', '/' or die "open(/) $!"; fchdir($self); close($_) for (grep(defined, delete @$self{qw(0 1 2 sock)})); - if (my $cfg = $self->{cfg}) { - delete @$cfg{qw(-lei_store -watches -lei_note_event)}; - } + delete @$cfg{qw(-lei_store -watches -lei_note_event)}; } else { # worker, Net::NNTP (Net::Cmd) uses STDERR directly open STDERR, '+>&='.fileno($self->{2}) or warn "open $!"; STDERR->autoflush(1); POSIX::setpgid(0, $$) // die "setpgid(0, $$): $!"; + delete @$cfg{qw(-watches -lei_note_event)}; } close($_) for (grep(defined, delete @$self{qw(old_1 au_done)})); delete $self->{-socks};