You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Operating system: linux
* Ruby implementation: Ruby
* `concurrent-ruby` version: 1.1.10
* `concurrent-ruby-ext` installed: no
* `concurrent-ruby-edge` used: no
The test script
# frozen_string_literal: truerequire'bundler/inline'gemfile(true)dosource'https://rubygems.org'gem'concurrent-ruby','1.1.10'gem'memory_profiler','~> 1'endclassThing;enddefreport(title, &block)putstitleppMemoryProfiler.report(&block).retained_memory_by_classendreport('Warmup')doConcurrent::Promises.future{Thing.new}.waitendreport('When waiting for the Future')doConcurrent::Promises.future{Thing.new}.waitendreport('When waiting for the Future with args')doConcurrent::Promises.future(Thing.new){ |o| o}.waitendreport('When waiting for the Future and actively dereferencing it')dox=Concurrent::Promises.future{Thing.new}.waitx=nilendreport('When waiting for the Future with args and actively dereferencing it')dox=Concurrent::Promises.future(Thing.new){ |o| o}.waitx=nilend
yields the following output
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using bundler 2.3.19
Using memory_profiler 1.0.0
Using concurrent-ruby 1.1.10
Warmup
[{:data=>"Thread", :count=>1048992},
{:data=>"Concurrent::CachedThreadPool", :count=>216},
{:data=>"Thread::Mutex", :count=>216},
{:data=>"Array", :count=>200},
{:data=>"Thread::ConditionVariable", :count=>192},
{:data=>"Concurrent::Event", :count=>144},
{:data=>"Proc", :count=>80},
{:data=>"String", :count=>80},
{:data=>"Thread::Queue", :count=>76},
{:data=>"Concurrent::RubyThreadPoolExecutor::Worker", :count=>40}]
When waiting for the Future
[{:data=>"Array", :count=>40}]
When waiting for the Future with args
[{:data=>"Array", :count=>40}]
When waiting for the Future and actively dereferencing it
[{:data=>"Array", :count=>40}]
When waiting for the Future with args and actively dereferencing it
[{:data=>"Array", :count=>40}]
Note that in contrast to #959 the return value of the block is not leaking here.
The text was updated successfully, but these errors were encountered:
Maybe this "leak" is intentional, i.e. keeping a pool of sub-threads in a thread-local variable which is then garbage collected when the parent thread is garbage collected 🤔
The test script
yields the following output
Note that in contrast to #959 the return value of the block is not leaking here.
The text was updated successfully, but these errors were encountered: