From: RK Sentinel Date: 2009-01-23T14:17:16+09:00 Subject: Re: String doesnt auto dup on modification >> >> - Do you habitually dup() your string ? > I try to, and I try to get rid of all references to the original > string as soon as possible. > This is because incremental GC works so well nowadays and allows for > some clean code. > Freezing a string seems like a good idea sometimes, but if that means > holding on to the object longer than needed this might not be such a > good idea after all. > > R. Interesting point. So freezing a string prevents collection as long as there are referers (obvious), but duping it helps release the original one, but you still have a new string in memory. So net you still are taking the same memory. Is there a writeup on Ruby GC collection, my knowledge of GC is java based, and it is 5 years old (based on the Inside the VM book and various other articles on sun.com). Is ruby's GC "generational" ? In which iirc, an older object would have moved to an older generation and be less likely to be collected. Any links to ruby's GC would be appreciated. -- Posted via http://www.ruby-forum.com/.