From: ara.t.howard@... Date: 2006-08-26T01:07:08+09:00 Subject: Re: How are the object_ids generated/assigned to objects? On Sat, 26 Aug 2006, Pavel Smerk wrote: > Hello, > > assume some multithreaded application, thread1 starts and finishes, then > thread2 starts --- how is the possibility that these two threads will have > the same object_id? On what it depends? > > Thanks, > > P. interesting question! harp:~ > cat a.rb h = {} loop{ tid = Thread.new{}.object_id; (warn h.size.to_s and h.delete(tid)) if h[tid]; h[tid] = true } harp:~ > ruby a.rb 2>&1|head 4344 4344 5428 5428 5428 5428 6510 6510 6510 6510 looks like they recycle every few thousand threads - depending on how long the threads run of course. cheers. -a -- to foster inner awareness, introspection, and reasoning is more efficient than meditation and prayer. - h.h. the 14th dalai lama