From: nobu.nokada@... Date: 2004-02-06T13:02:09+09:00 Subject: Re: Is there any way to mark an object as "always in use" (specifically, in a C extension)? Hi, At Fri, 6 Feb 2004 11:49:59 +0900, Harry Ohlsen wrote in [ruby-talk:91669]: > > Is it the single big hash in process, but not per instance, > > right? > > There's a single hash table, that's not registered as a Ruby > object. However, the data stored in the table are all VALUE > objects obtained from rb_str_new2(). You mean struct st_table? If so, you may register a Hash instance to GC and use its tbl member directly. > There is a single instance of an object implemented in C that > Ruby *does* know about, and that object holds many references > to the strings in the hash table. For one document, for > example, there were 2.7 million references to around 87,000 > strings, totalling just under 267,000 bytes of text. It's > the ..._mark() function of that class where I currently mark > all of the strings. Current ruby's GC is weak for large amounts of live objects. > While it doesn't *seem* to be taking a huge amount of time to > do that each time, I'd like to try to avoid it, just to see > whether that really is the case ... ie, see whether the > actual time being used is significant. In any case, if it's > easy to fix, it just doesn't make sense to keep marking them > over and over. Generational GC may help you, but it isn't still incorporated. -- Nobu Nakada