From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS47066 71.19.144.0/20 X-Spam-Status: No, score=-1.9 required=3.0 tests=AWL,BAYES_00 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: normalperson@yhbt.net Received: from zedshaw2.xen.prgmr.com (zedshaw2.xen.prgmr.com [71.19.156.177]) by dcvr.yhbt.net (Postfix) with ESMTP id 5ABAF1F6BF for ; Tue, 30 Apr 2013 02:40:09 +0000 (UTC) Received: from zedshaw2.xen.prgmr.com (unknown [IPv6:::1]) by zedshaw2.xen.prgmr.com (Postfix) with ESMTP id CB16A73E01 for ; Tue, 30 Apr 2013 02:42:06 +0000 (UTC) MIME-Version: 1.0 Date: Tue, 30 Apr 2013 02:39:41 +0000 From: Eric Wong List-Archive: List-Help: List-Id: List-Post: List-Subscribe: List-Unsubscribe: Message-Id: <1367289582-31293-17-git-send-email-normalperson@yhbt.net> Precedence: list References: <1367289582-31293-1-git-send-email-normalperson@yhbt.net> Sender: sleepy.penguin@librelist.org Subject: [sleepy.penguin] [PATCH 16/17] epoll: clear FD marks snapshot before returning To: sleepy.penguin@librelist.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit This allows the heap to reclaim memory sooner (than waiting for GC), lowering memory usage and perhaps speeding up future allocations. --- lib/sleepy_penguin/epoll.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sleepy_penguin/epoll.rb b/lib/sleepy_penguin/epoll.rb index f29189a..637db8d 100644 --- a/lib/sleepy_penguin/epoll.rb +++ b/lib/sleepy_penguin/epoll.rb @@ -67,7 +67,7 @@ def wait(maxevents = 64, timeout = nil) @io.epoll_wait(maxevents, timeout) { |events, io| yield(events, io) } ensure # hopefully Ruby does not optimize this array away... - snapshot[0] + snapshot.clear end # Starts watching a given +io+ object with +events+ which may be an Integer -- 1.8.2.1.367.gc875ca7