user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 0/8] nntp: eliminate response-duration cyclic refs
Date: Sat, 21 Dec 2019 07:59:59 +0000	[thread overview]
Message-ID: <20191221080007.27810-1-e@80x24.org> (raw)

While there are no known memory leaks in our code, the short-lived
reference cycle introduced by the long_response API is a potential
source of bugs.

Change the long_response API and update callers to pass
parameter explicitly to named subroutines instead of anonymous
ones.

Since creating new anonymous subs (aka "closures") take a fair
amount of memory in Perl, this ought to reduce memory pressure,
as well, since we're now only creating lightweight references to
long-lived subs.  The tradeoff is we make a few more hash
lookups since we no longer cache some hash lookups into local
variables onto the stack.

Eric Wong (8):
  nntp: get_range: return scalarref for $beg
  nntp: remove cyclic refs from long_response
  nntp: hdr_searchmsg: use named sub for numeric range response
  nntp: cmd_xrover: use named sub for long_response
  nntp: cmd_listgroup: use named subs for long_response
  nntp: cmd_newnews: use named sub for long_response
  nntp: hdr_msg_id: use named sub for long_response
  nntp: cmd_xover: use named sub for long_response

 lib/PublicInbox/NNTP.pm | 293 +++++++++++++++++++++-------------------
 1 file changed, 152 insertions(+), 141 deletions(-)


             reply	other threads:[~2019-12-21  8:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-21  7:59 Eric Wong [this message]
2019-12-21  8:00 ` [PATCH 1/8] nntp: get_range: return scalarref for $beg Eric Wong
2019-12-21  8:00 ` [PATCH 2/8] nntp: remove cyclic refs from long_response Eric Wong
2019-12-21  8:00 ` [PATCH 3/8] nntp: hdr_searchmsg: use named sub for numeric range response Eric Wong
2019-12-21  8:00 ` [PATCH 4/8] nntp: cmd_xrover: use named sub for long_response Eric Wong
2019-12-21  8:00 ` [PATCH 5/8] nntp: cmd_listgroup: use named subs " Eric Wong
2019-12-21  8:00 ` [PATCH 6/8] nntp: cmd_newnews: use named sub " Eric Wong
2019-12-21  8:00 ` [PATCH 7/8] nntp: hdr_msg_id: " Eric Wong
2019-12-21  8:00 ` [PATCH 8/8] nntp: cmd_xover: " Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191221080007.27810-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).