News for hackers. Stuff that matters.
Re:Garbage Collection in Ruby 2.1 by stcredzero on Monday December 30, 2013 @01:45PM (#6986097)
So Ruby objects occupy 40 bytes each, inside pages on the eden heap.

That's pretty huge. That's several times larger than some other dynamic languages -- languages that have essentially the same features as Ruby.

Re:Garbage Collection in Ruby 2.1 by phamilton on Monday December 30, 2013 @06:44PM (#6987903)
Not really. Python primitives are smaller (24 bytes). Python strings are 37 + 1 byte per character. Python objects are 72 bytes. Python classes are 104 bytes. (Got these numbers playing around with sys.getsizeof in the python console.)

Primitives are a bit bigger in ruby, but they aren't really primitives anyway (everything is an object).

Re:Garbage Collection in Ruby 2.1 by stcredzero on Monday December 30, 2013 @07:25PM (#6988112)
Python is another offender!
Re:Garbage Collection in Ruby 2.1 by phamilton on Monday December 30, 2013 @07:35PM (#6988158)
What languages are you referring to than? Perl and PHP are really the only others that are sort of in the same class as Ruby and Python.
Re:Garbage Collection in Ruby 2.1 by stcredzero on Monday December 30, 2013 @07:57PM (#6988255)
Smalltalk, for one.
Re:Garbage Collection in Ruby 2.1 by rurban on Monday December 30, 2013 @09:30PM (#6988583)
Perl objects are even bigger and need one indirection per access. A perl head is 32 bytes plus 48 byte body, ie. 80byte on 64bit systems.

For my perl rewrite p2 I need one single word per object on the stack. Common Lisps usually needs two words, the class pointer and the tagged value.

I really liked the visualization of the various GC's btw. Excellent work!

Re:Garbage Collection in Ruby 2.1 by riffraff on Monday December 30, 2013 @04:04PM (#6986938)
I have no idea of the size in other language implementations, but notice 40 bytes is on x86-64, on 32 bit it's either 20 or 24.
Re:Garbage Collection in Ruby 2.1 by joevandyk on Monday December 30, 2013 @05:06PM (#6987338)
this is why running large ruby apps on 64 bit OSs can take up a lot more memory than 32 bit.
Re:Garbage Collection in Ruby 2.1 by riffraff on Monday December 30, 2013 @05:34PM (#6987519)
isn't that true of most platforms? I know the JVM has compressed OOPS to limit this issue, but I am not aware of similar things elsewhere.