From: Kyle Rawlins Date: 2002-05-25T05:48:48+09:00 Subject: Re: FAQ for newcomers familiar with lower level language On Wed, May 22, 2002 at 11:20:48PM +0900, Yohanes Santoso wrote: > Q. But I'm concerned about the memory footprint size! > > A. Perhaps you are using the wrong language. Have you considered using > another language with manual memory management? If you are already > attached to ruby, then do you know about the C-language binding? You > can implement the section that requires careful memory management in > C and the rest in ruby. I saw this sentiment expressed earlier in a post, and resisted the chance to comment, but this is something that worries me. I like to give at least some thought in any language I'm writing in to the memory usage and efficiency of the code, regardless of whether the language is garbage collected or not. It occurs me that the road of people just ignoring this altogether is not a particularly good one in general. I had formed the opinion that the purpose of garbage collection was to help prevent memory allocation/deallocation errors, and not so that the programmer could assume that there is an unlimited amount of memory that gets allocated in a miniscule amount of time. I am saying this from the perspective of being a confirmed user of GC'd languages, and only use C if I am forced to it. I also do not think that manual memory management really always results in more efficient use of memory. I am quite willing to trust that a GC will probably do just as good of a job of choosing when to allocate/deallocate and what to allocate/deallocate is I would, and possibly better. The reason someone who is very concerned about the memory footprint would use, say, C, would be that data types just end up being smaller than higher level objects. I would speculate (having absolutely no figures to back this up :-) that much more significant memory gains can be had by choosing algorithms which reduce object creation/allocation, in any language, than by doing things like factoring out another byte from a struct in languages where it is possible. In short, though memory management is made very easy in Ruby and other GC'd languages, it worries me greatly that it could be considered good programming practice to write anything beyond a simple script without thinking about issues of resource usage. It is entirely possible that this is an aesthetic judgement rather than one that has any significant functional result for most cases, but I just can't bring myself to think that automating something means that one can just then ignore it. -kyle -- http://mas.cs.umass.edu/~rawlins -- and everybody wants to know you is rapt like moon river then beyond the blinds