In memoriam: OpenStruct

You’re off the team, OpenStruct.

> report.pretty_print

Total allocated: 3155813073 bytes (28184286 objects)
Total retained:  238163330 bytes (1614205 objects)

allocated memory by gem
-----------------------------------
1196063672  ostruct
 956078904  activesupport-6.1.4.4
 946622162  home/app
  17870435  activerecord-6.1.4.4
  17529296  msgpack-1.4.2

allocated memory by file
-----------------------------------
1196063672  /usr/local/lib/ruby/3.0.0/ostruct.rb
 681466200  /bundle/ruby/3.0.0/gems/activesupport-6.1.4.4/lib/active_support/core_ext/enumerable.rb
 175516474  /bundle/ruby/3.0.0/gems/activesupport-6.1.4.4/lib/active_support/core_ext/time/calculations.rb

allocated memory by location
-----------------------------------
 693705400  /usr/local/lib/ruby/3.0.0/ostruct.rb:214
 676964360  /bundle/ruby/3.0.0/gems/activesupport-6.1.4.4/lib/active_support/core_ext/enumerable.rb:41
 410979320  /usr/local/lib/ruby/3.0.0/ostruct.rb:215
 175505504  /bundle/ruby/3.0.0/gems/activesupport-6.1.4.4/lib/active_support/core_ext/time/calculations.rb:318
  91370208  /usr/local/lib/ruby/3.0.0/ostruct.rb:146
  77160096  /bundle/ruby/3.0.0/gems/activesupport-6.1.4.4/lib/active_support/core_ext/date_time/calculations.rb:206
  16374222  /bundle/ruby/3.0.0/gems/msgpack-1.4.2/lib/msgpack/factory.rb:70
  10564544  /bundle/ruby/3.0.0/gems/activerecord-6.1.4.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:65

allocated memory by class
-----------------------------------
1549848928  Array
 561299680  Proc
 420654704  Class
 181192312  Hash
 175399659  String
 171466880  DateTime
  81214000  Rational
   9113840  OpenStruct
   1337760  ActiveSupport::JSON::Encoding::JSONGemEncoder::EscapedString
   1248310  Time

allocated objects by gem
-----------------------------------
  11680836  home/app
  10730291  ostruct
   4963412  activesupport-6.1.4.4
    321874  msgpack-1.4.2
    261638  activerecord-6.1.4.4

allocated objects by file
-----------------------------------
  10730291  /usr/local/lib/ruby/3.0.0/ostruct.rb
   3101781  /bundle/ruby/3.0.0/gems/activesupport-6.1.4.4/lib/active_support/core_ext/time/calculations.rb
   1071668  /bundle/ruby/3.0.0/gems/activesupport-6.1.4.4/lib/active_support/core_ext/date_time/calculations.rb

allocated objects by location
-----------------------------------
   6849659  /usr/local/lib/ruby/3.0.0/ostruct.rb:215
   3652670  /usr/local/lib/ruby/3.0.0/ostruct.rb:214
   3101636  /bundle/ruby/3.0.0/gems/activesupport-6.1.4.4/lib/active_support/core_ext/time/calculations.rb:318
   1071668  /bundle/ruby/3.0.0/gems/activesupport-6.1.4.4/lib/active_support/core_ext/date_time/calculations.rb:206

allocated objects by class
-----------------------------------
  11675518  Array
   7016246  Proc
   4179680  String
   2143336  DateTime
   2030350  Rational
    605654  Hash
    228255  Class
    227846  OpenStruct

retained memory by gem
-----------------------------------
 212691288  ostruct
  13123073  msgpack-1.4.2

retained memory by file
-----------------------------------
 212691288  /usr/local/lib/ruby/3.0.0/ostruct.rb
  13123073  /bundle/ruby/3.0.0/gems/msgpack-1.4.2/lib/msgpack/factory.rb
   3135621  /bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/core_ext/hash.rb

retained memory by location
-----------------------------------
 160806744  /usr/local/lib/ruby/3.0.0/ostruct.rb:214
  38433080  /usr/local/lib/ruby/3.0.0/ostruct.rb:215
  13451424  /usr/local/lib/ruby/3.0.0/ostruct.rb:146
  13123073  /bundle/ruby/3.0.0/gems/msgpack-1.4.2/lib/msgpack/factory.rb:70
   2614656  /bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/core_ext/hash.rb:52

retained memory by class
-----------------------------------
 122640368  Class
  76946720  Proc
  16700336  String
  14529824  Hash
   3572928  Array
   3202720  OpenStruct
    227600  ActiveModel::Attribute::WithCastValue
    112568  RubyVM::InstructionSequence

retained objects by gem
-----------------------------------
   1120964  ostruct
    313947  msgpack-1.4.2
    160460  home/app
      7433  i18n-1.8.11
      4772  activemodel-6.1.4.4
      3130  activerecord-6.1.4.4

retained objects by file
-----------------------------------
   1120964  /usr/local/lib/ruby/3.0.0/ostruct.rb
    313947  /bundle/ruby/3.0.0/gems/msgpack-1.4.2/lib/msgpack/factory.rb
      7262  /bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/core_ext/hash.rb

retained objects by location
-----------------------------------
    560476  /usr/local/lib/ruby/3.0.0/ostruct.rb:214
    480419  /usr/local/lib/ruby/3.0.0/ostruct.rb:215
    313947  /bundle/ruby/3.0.0/gems/msgpack-1.4.2/lib/msgpack/factory.rb:70
     80068  /usr/local/lib/ruby/3.0.0/ostruct.rb:146
      3138  /bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/core_ext/hash.rb:52
      2863  /bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/core_ext/hash.rb:42

retained objects by class
-----------------------------------
    961834  Proc
    400050  String
     81902  Hash
     80173  Class
     80068  OpenStruct
      4205  Array
      2845  ActiveModel::Attribute::WithCastValue
      1579  Symbol

See also: