From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id UalBDSxfsGCxBgAAgWs5BA (envelope-from ) for ; Fri, 28 May 2021 05:10:36 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id WMuDCCxfsGBCFgAAB5/wlQ (envelope-from ) for ; Fri, 28 May 2021 03:10:36 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3EDF616E14 for ; Fri, 28 May 2021 05:10:31 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 9D6E82A9EB; Thu, 27 May 2021 23:10:22 -0400 (EDT) Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by mail.notmuchmail.org (Postfix) with ESMTPS id 583EE26876 for ; Thu, 27 May 2021 23:10:20 -0400 (EDT) Received: by mail-wr1-x42d.google.com with SMTP id x7so1749685wrt.12 for ; Thu, 27 May 2021 20:10:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=97eYplsg35wZi2OP81FBoZ1Hl4hZy56wwtZD2f6JGOk=; b=pEvwS/+jxr8cvQKordbDHHz6Dq5hOz4UbXeD2m81/j4/7ku5Gv30v3A06amy146Nt4 sWDst2WbjUVbvUu09RnrsQVAcPEd9j9O4meKFnGFbqYoE+TSb19ojw5Q9XSkSBTforlF p9eZ9HbRMA8LkTq+al/UP/7UgPGyO9xK6RgPj4vIOC9umzsdbTOck+8S+PP9jjC7nWEV NA42wNAONsmE9vsW6kXLBMKqoqZ0T3/d67lCvLeZ5JLPtTdmIjTja1TNmJrJZxOPZULM +d1NZHspX2QVJkOZFhYj7318RTHE9SqjHHwcCwrsdag4w7n68ctwEiG/vVMDWABUMr+0 xrUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=97eYplsg35wZi2OP81FBoZ1Hl4hZy56wwtZD2f6JGOk=; b=nNcH6c5md2C15XRAatF1OjULxsf5FcogdXs3/LVuLkt098h2GPUNNc0etjA8DG5tNb NrtYwm+Cw4ngtjveLQJA8bzGEITg5xziKLZWv20stU5KUuuGXqYNMbqRT69HMVp0o+Ai uOttIYpA+Eg8N+IAomqfN5XmtszoXBDX2IGJnpxNZQRZNd5/hnobk2moOgRHWEpLZo/W e2fjEVRgGo63VJJVidpMCNpIT/R1wgoHv4QgQ9Y9MmGhPSjT7563xH3HkVmtMMaNrKDN ZuVxFNuk+irHe0fF0trdVWYW6dCVVT7uwJrtLE+qOeMgC9XjZI7na1vQ9VC9KW3ERsm9 p/Ag== X-Gm-Message-State: AOAM530L8wwXIfBGKKgjsry/YZP4Z8fZ/YKxiMBcAJGqI1AhzF+EL/ix YzR9eAt2bDg+Yz7xFhebSjDou6Na6kONbe2zmIQ= X-Google-Smtp-Source: ABdhPJxNbrxXLucT//lqB+Vskz8JSjSeMME33CgUGF/oBl9n2d6W+z+IU/5kich1t3vGCw5LGcAj9ftl2hc/2/c746I= X-Received: by 2002:adf:e8c3:: with SMTP id k3mr6323636wrn.255.1622171415488; Thu, 27 May 2021 20:10:15 -0700 (PDT) MIME-Version: 1.0 References: <20210517193915.1220114-1-felipe.contreras@gmail.com> <87y2c7t55j.fsf@tethera.net> In-Reply-To: <87y2c7t55j.fsf@tethera.net> From: Felipe Contreras Date: Thu, 27 May 2021 22:10:04 -0500 Message-ID: Subject: Re: [PATCH 0/2] ruby: enable garbage collection To: David Bremner Message-ID-Hash: 4ZVXBOLUQJJBQSAQEMXZCE74NT46FRYV X-Message-ID-Hash: 4ZVXBOLUQJJBQSAQEMXZCE74NT46FRYV X-MailFrom: felipe.contreras@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "notmuch@notmuchmail.org" , Tomi Ollila X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1622171432; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=VbHFuz76qGpWC9Ijj0ETnrEt9MhTN85ZS6GyvzAt8pQ=; b=nXixSkWI4m6l8uvokyyjJ+4EMrlKzwOBLfRpd0My1+PPSlNK7aW6tEfC2lsy9pKkdMzAQc HPhh5OLfg9vRC9ei9h0lqiHbFWGCiO4x1WHvej7FkoX7fGgHWhSShsn1K4AWc2JYp43mKh MMVko0M0nmohJv5arCSSyt3Ou/LvvZtD9GV5nETjBGk30IFdphQDOR5IHzei92TWgRzdsY kWcx00ZLUW+0kh/oRNTC5FPxLOSYVFkFig3JAIHfGvbOL1iJwe7ZRPIMdKMn70Dzp9wOea LejBJJ/C8aUw92tOlo3uIcR5eZlLX7ASJwruyyy3Ztz7/KkDFOhsnrKhKFO37w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1622171432; a=rsa-sha256; cv=none; b=VJzRi2sbqsezMyByuM5kiXrtGR8XNDpJzV+agDYIz0aJAicuwLo/gvdgPcC61WdTzEvY9d 3dGyefQM2dCEEBDVL4WqoemNZzjJoRqn18pEOyOE59SYzS78QDYL3qBmNppY8B1CGz9riL vP+WhZ7GUOyXbUJsXTLdmac5/g8tRuGPsG/1BqkkTog4FqYR08wp0/Ja601EzAwPuCrGAf Qd7Dg0N+KxZ3Op9TYGMHB8qeWP59bw1Egy72Qn9FtfxvuvdoA7hfw8e8ty1S6YUda9MUeb wKIjOunisxpUJvjD96+k6Cw9ZRBodyT8+kOtQWgNbftSsHco6J3D8AMqAcf2hQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20161025 header.b="pEvwS/+j"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: 0.54 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20161025 header.b="pEvwS/+j"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 3EDF616E14 X-Spam-Score: 0.54 X-Migadu-Scanner: scn1.migadu.com X-TUID: ChWlEux/ijQe On Sat, May 22, 2021 at 5:49 AM David Bremner wrote: > > Felipe Contreras writes: > > > Ruby is a gc language, we shouldn't be doing workaround to free memory when Ruby is perfectly > > capable of doing so. > > > > The problem is that talloc wants to be smart, and Ruby and talloc both fight to free memory. We can > > let Ruby win by stealing all the objects from talloc control. > > > > Thanks to the previous cleanup patches it's now possible to easily do this. > > > > In order to test this series I've used the following script: > > I still haven't had a chance to look at the series, but how about making > this script either a test or a performance-test, as appropriate? I gave this a try, and even compiled Ruby with --with-valgrind (apparently Arch Linux doesn't do that), but doesn't seem to work right: % valgrind /opt/ruby/bin/ruby -e 'p true' HEAP SUMMARY: in use at exit: 37,193,788 bytes in 21,951 blocks total heap usage: 61,729 allocs, 39,778 frees, 51,503,615 bytes allocated LEAK SUMMARY: definitely lost: 510,491 bytes in 4,617 blocks indirectly lost: 795,436 bytes in 9,411 blocks possibly lost: 2,128,254 bytes in 7,100 blocks still reachable: 33,759,607 bytes in 823 blocks suppressed: 0 bytes in 0 blocks Rerun with --leak-check=full to see details of leaked memory Trying to run the simplest of Ruby commands throws a log 93,000 lines long. I did try to search online resources to use valgrind with Ruby to no avail. Apparently everyone is using valgrind with a baseline (if valgrind shows 500 KiB lost as a start, how much does it change after my changes?). Sure, we could try to massage a valgrind suppression file, but is it worth the effort if the Ruby project itself hasn't even tried to do that? If we wanted to measure the memory performance of such a command (which I think would be very nice) a different strategy is needed. I also didn't see any talloc output. For now I don't think the series should be blocked by this setback. Just try to run the command yourself with top. You can see it works. Cheers. -- Felipe Contreras