赖洪礼的 blog » How the Ruby heap is implemented
Popularity Report
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
URL Tag Cloud
- programming
- , 男士衬衣
- , check_later
- , memory
- , heap
- , ruby
- , blag
- , toread
- , DevRoR
- , BeforeDiigo
Bookmark History
Saved by 4 people (2 private), first by anonymouse user on 2007-10-28
- Untaldouglas on 2008-03-21 - Tags DevRoR
- Harryli on 2007-11-12 - Tags 男士衬衣
- Eban777 on 2007-10-28 - Tags toread
- Fiz1point5 on 2007-10-27 - Tags ruby , programming , memory , heap , blag , check_later
Public Sticky notes
All those types are actually child type of a single parent type: RBasic.
Since Ruby is written in C, the implementation doesn’t appear to be object oriented at first sight, even though it actually is (though in a very messy way, in my opinion). But let’s take a look how that’s implemented. This is how RClass and RFloat are defined:
Highlighted by harryli
Ruby uses a simple mark-and-sweep algorithm. It works as follows:
- Mark all objects that are accessible from the current point of the Ruby program (mark phase).
- Iterate through all objects and free those that are not marked (sweep phase).
Highlighted by harryli


Public Comment