Skip to content

Conversation

@ksss
Copy link
Collaborator

@ksss ksss commented Dec 4, 2024

Repro

# Gemfile
source "https://rubygems.org"
gem 'aws-sdk-quicksight' # It has many record types
$ bundle exec rbs collection init
$ bundle exec rbs collection install
# t.rb
require 'rbs'
require 'rbs/cli'
require 'memory_profiler'
report = MemoryProfiler.report do
  loader = RBS::CLI::LibraryOptions.new.loader
  env = RBS::Environment.from_loader(loader)
  env.resolve_type_names
end
report.pretty_print

Before

Total allocated: 593146847 bytes (6288468 objects)
Total retained:  239940 bytes (3582 objects)
...
allocated memory by location
-----------------------------------
 301030072  /Users/yuki.kurihara/src/github.com/ksss/rbs/lib/rbs/parser_aux.rb:20
  53040880  /Users/yuki.kurihara/src/github.com/ksss/rbs/lib/rbs/types.rb:529
  42449400  /Users/yuki.kurihara/src/github.com/ksss/rbs/lib/rbs/types.rb:680
  36932720  /Users/yuki.kurihara/src/github.com/ksss/rbs/lib/rbs/types.rb:530
  24652000  /Users/yuki.kurihara/src/github.com/ksss/rbs/lib/rbs/types.rb:596
  24599520  /Users/yuki.kurihara/src/github.com/ksss/rbs/lib/rbs/types.rb:374
  19889959  /Users/yuki.kurihara/src/github.com/ksss/rbs/lib/rbs/environment_loader.rb:164

After

Total allocated: 555155855 bytes (5427912 objects)
Total retained:  239940 bytes (3582 objects)
...
allocated memory by location
-----------------------------------
 301030072  /Users/yuki.kurihara/src/github.com/ksss/rbs/lib/rbs/parser_aux.rb:20
  42449400  /Users/yuki.kurihara/src/github.com/ksss/rbs/lib/rbs/types.rb:687
  24652000  /Users/yuki.kurihara/src/github.com/ksss/rbs/lib/rbs/types.rb:603
  24599520  /Users/yuki.kurihara/src/github.com/ksss/rbs/lib/rbs/types.rb:374
  19980288  /Users/yuki.kurihara/src/github.com/ksss/rbs/lib/rbs/types.rb:529
  19889959  /Users/yuki.kurihara/src/github.com/ksss/rbs/lib/rbs/environment_loader.rb:164
  19721600  /Users/yuki.kurihara/src/github.com/ksss/rbs/lib/rbs/types.rb:530

Copy link
Member

@soutaro soutaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@soutaro soutaro added this to the RBS 3.7 milestone Dec 5, 2024
@soutaro soutaro added this pull request to the merge queue Dec 5, 2024
Merged via the queue into ruby:master with commit e86296d Dec 5, 2024
18 checks passed
@ksss ksss deleted the record-memory branch December 5, 2024 03:05
@soutaro soutaro added the Released PRs already included in the released version label Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Released PRs already included in the released version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants