From: SASADA Koichi Date: 2013-10-04T10:24:07+09:00 Subject: [ruby-core:57652] Re: [ruby-trunk - Bug #8983] [PATCH] GC.stat[:heap_free_num] returns number of unused slots on heap (2013/10/04 10:09), tmm1 (Aman Gupta) wrote: > I understand the slot is removed, but `objspace_live_num` includes unfinalized objects so I included them in `heap_limit` also. > > Otherwise, `objspace->heap.limit - objspace_live_num(objspace)` can become negative. I got it. objspace_live_num() should return the count including zombie (waiting to finallization) because they are still living (living dead!!). However, we can eliminate zombiees from live_num() because they are not living normal objects. Two approachs? (1) eliminate zombies from live_num (2) count zombie_num (objspace->heap.limit - (objspace_live_num(objspace) - zombie_num) -- // SASADA Koichi at atdot dot net