peter michaux wrote:
>
> Could someone describe how symbols are stored in memory?
>
> Something like (I don't know if any of these are correct)
>
> int 32 bytes
> float 64 bytes
> string 8 bytes for the pointer and a byte for each character including
> one for "\0"
>

An int is the key into a table which holds the name.
Script reveals allocation as "previous + 1" sequence.


puts ' :name  object_id  >>11 (i>>3)'
puts '-'*30
s = 's_00'
5.times do |n|
   sym = s.next!.to_sym
   syid = sym.object_id
   raise if syid & 0x7ff != 0x10e
   puts ' :%s  %08x   %d (%d)' % [sym, syid, syid >> 11, sym.to_i >> 3]
end

=begin
 :name  object_id  >>11 (i>>3)
------------------------------
 :s_01  0026710e   1230 (1230)
 :s_02  0026790e   1231 (1231)
 :s_03  0026810e   1232 (1232)
 :s_04  0026890e   1233 (1233)
 :s_05  0026910e   1234 (1234)
=end


daz