From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id CCAB02070D for ; Sat, 31 Dec 2016 04:46:10 +0000 (UTC) From: Eric Wong 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> List-Id: 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