yahns Ruby server user/dev discussion
 help / color / mirror / Atom feed
* [PATCH] proxy_http_response: reduce memory pressure from larger headers
@ 2016-12-31  4:46 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2016-12-31  4:46 UTC (permalink / raw)
  To: yahns-public

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,
anyways.

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
-- 
EW


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-12-31  4:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-31  4:46 [PATCH] proxy_http_response: reduce memory pressure from larger headers Eric Wong

yahns Ruby server user/dev discussion

This inbox may be cloned and mirrored by anyone:

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

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 yahns-public yahns-public/ https://yhbt.net/yahns-public \
		yahns-public@yhbt.net yahns-public@rubyforge.org
	public-inbox-index yahns-public

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.yahns
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.yahns
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for the project(s) associated with this inbox:

	yahns.git

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