From: Eric Hodel Date: 2007-09-27T16:43:48+09:00 Subject: Re: object_id 1, 2, 3 On Sep 26, 2007, at 14:00 , Tim Hunter wrote: > Also, because of the way operating systems dole out memory to C > programs, the memory addresses are usually going to be very large > numbers. > Of course at this point somebody will pipe up and say that what I just > wrote is untrue on such-and-such an obscure computer, and they'd be > right. You don't need to go quite so far. OS X starts its heap at a low memory address: $ ruby -ve "p ''.object_id" ruby 1.8.6 (2007-09-23 patchlevel 5000) [powerpc-darwin8.10.0] 1002180 $ ruby -ve "p ''.object_id" ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-freebsd6] 67351450 Also, the way ruby's heap is constructed, addresses will count down then jump up to the next chunk of ruby heap slots (provided that no GC is done): $ ruby -e "p %w[a b].map { |o| o.object_id }" [1002060, 1002050] Also, on 64 bit platforms ruby objects are twice as big due to bigger pointers and whatnot: $ ruby -ve "p %w[a b].map { |o| o.object_id }" ruby 1.8.5 (2006-08-25) [amd64-freebsd6] [2789280, 2789260]