The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Memory footprint of objects in Ruby 1.8. 1.9 and OCaml

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Eigen Class

Posts: 358
Nickname: eigenclass
Registered: Oct, 2005

Eigenclass is a hardcore Ruby blog.
Memory footprint of objects in Ruby 1.8. 1.9 and OCaml Posted: Mar 26, 2009 6:57 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Eigen Class.
Original Post: Memory footprint of objects in Ruby 1.8. 1.9 and OCaml
Feed Title: Eigenclass
Feed URL: http://feeds.feedburner.com/eigenclass
Feed Description: Ruby stuff --- trying to stay away from triviality.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Eigen Class
Latest Posts From Eigenclass

Advertisement

With Ruby 1.9.1 being out for a while now, it's time to review my calculations regarding the memory footprint of objects, since 1.9 incorporates some optimizations that improve significantly on 1.8. I also measured the footprint of OCaml objects while I was at it.

This table summarizes the results (sizes in bytes on x86; around (exactly, for OCaml) twice as much on x86-64 --- the malloc overhead might differ):

Ruby 1.8 Ruby 1.9 OCaml
object with no IVs 20 20 12
object 1 IV 120 20 16
object 2 IVs 144 20 20
object 3 IV 168 20 24
object 4 IV 192 48 28
struct (Struct or record) 1 elm. 32 20 8
struct 2 elms. 36 20 12
struct 3 elms. 40 20 16
struct 4 elms. 44 44 20

Keep in mind that both Ruby 1.8 and 1.9 can suffer from heavy memory fragmentation (both internal and external) when allocating many objects (also, objects might be retained for an arbitrarily long amount of time because the GC is conservative). OCaml has no such problem, as it has got a generational, exact GC with a copying GC in the minor heap and an incremental mark & sweep & compact GC in the major heap.

Read more...

Read: Memory footprint of objects in Ruby 1.8. 1.9 and OCaml

Topic: Configuration files Previous Topic   Next Topic Topic: RubyRX and AgileRX!

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use