unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: David Bremner <david@tethera.net>
Cc: "notmuch@notmuchmail.org" <notmuch@notmuchmail.org>,
	Tomi Ollila <tomi.ollila@iki.fi>
Subject: Re: [PATCH 0/2] ruby: enable garbage collection
Date: Thu, 27 May 2021 22:10:04 -0500	[thread overview]
Message-ID: <CAMP44s2o_pYR2Ht9nabqSJ6bc1AvADpQa+M6ex=jnyQMGcECow@mail.gmail.com> (raw)
In-Reply-To: <87y2c7t55j.fsf@tethera.net>

On Sat, May 22, 2021 at 5:49 AM David Bremner <david@tethera.net> wrote:
>
> Felipe Contreras <felipe.contreras@gmail.com> 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

  reply	other threads:[~2021-05-28  3:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-17 19:39 [PATCH 0/2] ruby: enable garbage collection Felipe Contreras
2021-05-17 19:39 ` [PATCH 1/2] ruby: create an actual wrapper struct Felipe Contreras
2021-07-18 22:58   ` David Bremner
2021-05-17 19:39 ` [PATCH 2/2] ruby: enable garbage collection using talloc Felipe Contreras
2021-06-11  0:46   ` David Bremner
2021-06-11  8:54     ` David Bremner
2021-06-26 19:07       ` Felipe Contreras
2021-06-26 19:54         ` David Bremner
2021-06-26 20:05           ` Felipe Contreras
2021-06-26 18:56     ` Felipe Contreras
2021-06-26 19:56       ` David Bremner
2021-05-22 10:49 ` [PATCH 0/2] ruby: enable garbage collection David Bremner
2021-05-28  3:10   ` Felipe Contreras [this message]
2021-06-26 20:07 ` [PATCH] perf-test: add ruby test Felipe Contreras
2021-07-18 22:54   ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMP44s2o_pYR2Ht9nabqSJ6bc1AvADpQa+M6ex=jnyQMGcECow@mail.gmail.com' \
    --to=felipe.contreras@gmail.com \
    --cc=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    --cc=tomi.ollila@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).