ActiveRecord should be arrested for memory abuse! Recently upgraded production legacy app from Rails 3 to 4.2.11 and Ruby 2.3.7 to 2.6.6.

Had to force GC in a major loop to reduce memory usage in background sidekiq workers.

record_count = -1
some_AREL_object.each do |record|
--- lots of AR stuff
record_count += 1
GC.start if 0 == record_count % 0
end

I'm working on a pure Ruby network packet encode/decode module using Array#pack and String#unpack. I did one of these about 16 years ago where everything was in one class. This time each format is a separate class like Uint8, Uint16, Uint32 and TimeStamp (which is a composite of 7 bytes) - with class methods encode and decode.

I'm kinda liking this current approach. Anyone do something similar? I'm expecting a little performance hit but frankly don't care at this point.

Ruby.social

A Mastodon instance for Rubyists & friends