ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: jean.boussier@gmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:99679] [Ruby master Feature#17103] Add a :since option to ObjectSpace.dump_all
Date: Mon, 24 Aug 2020 07:35:49 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-87166.20200824073548.7941@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-17103.20200804082655.7941@ruby-lang.org

Issue #17103 has been updated by byroot (Jean Boussier).


> this feature strongly connected with trace_object_allocations, right?

Indeed.

> so please write it on document. what happens on without trace_object_allocations? it is unclear.

I changed:

```
Objects that were allocated with object allocation tracing disabled are not dumped.
```

to:

```
Objects that were allocated without object allocation tracing enabled
are ignored. See ::trace_object_allocations for more information and
examples.
```

Is that acceptable?

----------------------------------------
Feature #17103: Add a :since option to ObjectSpace.dump_all
https://bugs.ruby-lang.org/issues/17103#change-87166

* Author: byroot (Jean Boussier)
* Status: Open
* Priority: Normal
----------------------------------------
Patch: https://github.com/ruby/ruby/pull/3368

This is useful for seeing what a block of code allocated, e.g.

```ruby
GC.start
GC.disable
gc_gen = GC.count
ObjectSpace.trace_object_allocations do
  # run some code
end
allocations = ObjectSpace.dump_all(output: :file, since: gc_gen)
GC.enable
GC.start
retentions = ObjectSpace.dump_all(output: :file, since: gc_gen)
```

For context, this is what I do in https://github.com/Shopify/heap-profiler, except that I have to dump the entire heap three times and then do a diff. This new API would allow me to dump the entire heap only once and then do two much-faster single-generation dumps without doing the diff.



-- 
https://bugs.ruby-lang.org/

  parent reply	other threads:[~2020-08-24  7:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-04  8:26 [ruby-core:99474] [Ruby master Feature#17103] Add a :since option to ObjectSpace.dump_all jean.boussier
2020-08-12  7:55 ` [ruby-core:99569] " ko1
2020-08-12 12:31 ` [ruby-core:99570] " jean.boussier
2020-08-24  4:49 ` [ruby-core:99678] " ko1
2020-08-24  7:35 ` jean.boussier [this message]
2020-08-27  0:19 ` [ruby-core:99718] " ko1
2020-08-27  7:33 ` [ruby-core:99726] " jean.boussier
2020-08-31  8:48 ` [ruby-core:99792] " matz
2021-01-18 14:36 ` [ruby-core:102138] " jean.boussier

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-list from there: mbox

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

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

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

  git send-email \
    --in-reply-to=redmine.journal-87166.20200824073548.7941@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /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.
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).