From: Sean O'Dell Date: 2002-02-24T10:01:50+09:00 Subject: Re: Object/Memory Management "Dave Thomas" wrote in message news:m24rk720r4.fsf@zip.local.thomases.com... > "Sean O'Dell" writes: > > > I wanted to use Ruby for my hosting system configuration, web site > > development and also plug it into an XML-over-HTTP application server I > > wrote/use. Currently, I'm using a blend of script languages and C++, and I > > want to replace my Perl stuff with something more reliable/readable in terms > > of being object-oriented and which uses exception-handling. Speed isn't > > that much of an issue, but memory resources are. Memory gets out of hand > > quick already, so when I think of all those strings/numbers/objects lying > > around as zombie objects after I'm done in a block of code, it sort of gets > > my hair standing up. > > It needn't. Ruby is pretty conservative - you'll find it garbage > collects frequently (too frequently sometimes, but that's a > performance issue). > > A suggestion. Write a typical application in Ruby, then run it and > monitor its memory usage. Watch the patterns. And see if its > acceptable. > > One last thought. Many (the majority?) of server-side web applications > are currently being written in the COBOL of the New Millennium, Java. > And Java uses garbage collection to dispose of objects. Seems to work > fine for these applications. C# (and the clr) use garbage collection > too. It seems to be with us to stay. That's where I am now. My evaluation period is moving on to actually converting some of my existing Perl applications. I'm converting because I'm really unhappy with the error handling in Perl and I just don't trust some of my stuff right now. I can think of lots of things that can go wrong, and I know my scripts won't handle certain system errors well, and I don't really want to obfuscate them further with tons of error-checking. I want to give them exception-handling instead; I can handle errors with much less code that way. I never did Java. I always used C++ for the heavy stuff, and my own script language for the HTML-embedded stuff (also stack-based object cleanup). I would have used PHP more if it were happier in our virtual hosting environments. I'm actually going to evaluate eRuby next and see if I can chroot it and/or see how hard it would be to convert it for that purpose and, if that pans out, start doing all the HTML-embedded stuff in Ruby. Probably no matter what, the heavy stuff will still be in C++. Actually, I don't mind garbage collection happening too frequently. Processor usage goes up and then back down. I was worried that memory usage would go up and not back down soon enough for the other processes to be happy with Ruby around. Sean Well, I'm giving it a go right now.