From: Eric Hodel Date: 2007-08-14T18:28:27+09:00 Subject: Re: Why don't Ruby libraries share memory? On Aug 13, 2007, at 20:14, Daniel DeLorme wrote: > Matt Harvey wrote: >> Sorry, I started talking about Rails again. The question is not >> about Rails. The questions are: Is there any way we can have >> shared Ruby libraries without turning the relevant code into a C >> extension? Is it necessary that code be compiled to be put into >> shared memory by the OS? > > The problem goes further than that. Even if you were to load your > libs in one process and then fork off worker processes (using copy- > on-write to share loaded code), the gargabe collector writes to > *every* page in memory when doing a garbage collecting run, thus > negating the benefits of COW. It's fixed in 1.9, thankfully, but > 1.8 is going to be a memory hog no matter which way you look at it. For .so files, no, for .rb files, yes. -- Poor workers blame their tools. Good workers build better tools. The best workers get their tools to do the work for them. -- Syndicate Wars