Skip to content

[Feature #21028] ObjectSpace#find_paths_to_unshareable_objects #13963

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

osyoyu
Copy link
Contributor

@osyoyu osyoyu commented Jul 21, 2025

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

Add a method to find paths to Ractor-unshareable objects which can be traced from an object.

Example:

class Container
  attr_reader :value
  def initialize(value)
    @value = value
  end
end

mutable_string = "hello"
container = Container.new(mutable_string)

pp ObjectSpace.find_paths_to_unshareable_objects(container).to_a
  #=> [
    [#<Container:0x00007fc35843e388 @value="hello">],
    [#<Container:0x00007fc35843e388 @value="hello">, "hello"]
  ]

Co-authored-by: Yusuke Endoh mame@ruby-lang.org

@osyoyu osyoyu force-pushed the objectspace-find-path-to-unshareable-object branch from bc07263 to 01f7338 Compare July 21, 2025 15:25

This comment has been minimized.

Add a method to find paths to Ractor-unshareable objects which can be
traced from an object.

Example:

    class Container
      attr_reader :value
      def initialize(value)
        @value = value
      end
    end

    mutable_string = "hello"
    container = Container.new(mutable_string)

    pp ObjectSpace.find_paths_to_unshareable_objects(container).to_a
      #=> [
        [#<Container:0x00007fc35843e388 @value="hello">],
        [#<Container:0x00007fc35843e388 @value="hello">, "hello"]
      ]

Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
@osyoyu osyoyu force-pushed the objectspace-find-path-to-unshareable-object branch from 01f7338 to 1b20e43 Compare July 24, 2025 15:38
@osyoyu osyoyu changed the title [Feature #21028] ObjectSpace#find_path_to_unshareable_object [Feature #21028] ObjectSpace#find_paths_to_unshareable_objects Jul 24, 2025
@osyoyu osyoyu force-pushed the objectspace-find-path-to-unshareable-object branch from 1b20e43 to a7efcfb Compare July 24, 2025 16:43
@osyoyu osyoyu marked this pull request as ready for review July 24, 2025 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy