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 93AEA201B0 for ; Fri, 17 Feb 2017 20:11:32 +0000 (UTC) From: Eric Wong To: yahns-public@yhbt.net Subject: [PATCH] http_response: make response headers eligible for GC, sooner Date: Fri, 17 Feb 2017 20:11:32 +0000 Message-Id: <20170217201132.8845-1-e@80x24.org> List-Id: Iterating through the response body can be time consuming and allocate memory, so nil out the headers object when we're done with it to give Ruby a chance to recover the memory. --- lib/yahns/http_response.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/yahns/http_response.rb b/lib/yahns/http_response.rb index bde4b3f..865193d 100644 --- a/lib/yahns/http_response.rb +++ b/lib/yahns/http_response.rb @@ -200,7 +200,7 @@ def http_response_write(res, opt) return step_write end - wbuf = rv = nil + headers = wbuf = rv = nil body.each do |x| if wbuf rv = wbuf.wbuf_write(self, x) -- EW