From: Logan Capaldo Date: 2006-06-02T16:57:54+09:00 Subject: Re: How can I pin a Ruby object in memory? On Jun 1, 2006, at 8:23 PM, John Lam wrote: > So I would guess that Ruby memory allocation is relatively expensive? > Certainly nowhere near as fast as allocating memory off of the "end" > of the heap or the stack, right? Does it have to search a free list of > blocks itself or does it delegate allocation to the system's malloc() > implementation? Speaking without any knowledge of ruby's internals I imagine it's actually is just allocating from the end of some pre-allocated buffer until it reaches the end of the buffer. So if you never run out of room in the buffer the allocation is just incrementing a pointer. When you reach the end you do the first GC and subsequent allocations have to search the freelist for a big enough chunk.