From: Erik Terpstra Date: 2002-05-22T16:29:09+09:00 Subject: Re: Memory consumption. Niklas Frykholm wrote: > [Erik Terpstra]: > >>>>Is there some method that tells me how much memory a certain object >>>>consumes? >>> >>>String: 4 long + 1 pointer + the length of your string in bytes * 1 char >>>Fixnum: 2 long + 1 int >>>Array: 4 long + 1 pointer + the length of your array * 1 pointer >> >>Hmmm thanks, but I'm affraid that doesn't really help me when I want to >>know the memory consumption of a DOM tree for example. > > > I guess > > Marshal.dump(object).size > > would give you a rough estimate. If you want something more precise > you will probably have to write a recursive function based on the > above and Object#instance_variables. Thanks for the help. Erik.