yahns Ruby server user/dev discussion
 help / color / Atom feed
From: Eric Wong <e@80x24.org>
To: yahns-public@yhbt.net
Subject: [PATCH] proxy_http_response: reduce memory pressure from larger headers
Date: Sat, 31 Dec 2016 04:46:10 +0000
Message-ID: <20161231044610.8772-1-e@80x24.org> (raw)

We try to cleanup after ourselves if possible so future mallocs
can find memory more easily.  We do not need to nil the object
slot, just String#clear since we're exiting the function soon,

Followup to commit bb774680aae0a827f887761b18da304aa94111cc
("use String#clear for short-lived buffers we create")
 lib/yahns/proxy_http_response.rb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/yahns/proxy_http_response.rb b/lib/yahns/proxy_http_response.rb
index 1776291..7df2834 100644
--- a/lib/yahns/proxy_http_response.rb
+++ b/lib/yahns/proxy_http_response.rb
@@ -132,7 +132,9 @@ def proxy_res_headers(res, req_res)
     # send the headers
     case rv = kgio_syssend(res, flags)
-    when nil then break # all done, likely
+    when nil # all done, likely
+      res.clear
+      break
     when String # partial write, highly unlikely
       flags = MSG_DONTWAIT
       res = rv # hope the skb grows

                 reply index

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:

  List information: https://yhbt.net/yahns/README

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

  git send-email \
    --in-reply-to=20161231044610.8772-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=yahns-public@yhbt.net \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

yahns Ruby server user/dev discussion

Archives are clonable:
	git clone --mirror https://yhbt.net/yahns-public
	git clone --mirror http://ou63pmih66umazou.onion/yahns-public

Example config snippet for mirrors

Newsgroups are available over NNTP:

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git