From: "Mauricio Fernández" Date: 2002-10-01T07:24:04+09:00 Subject: Re: Where Is Method Call Precedence? On Tue, Oct 01, 2002 at 04:37:38AM +0900, William Djaja Tjokroaminata wrote: > Hi, > > Isn't that in the current Ruby (1.6.7) the memory area is already managed > in the 'VALUE *ptr' member of struct RArray? Are you also suggesting to > remove both 'len' and 'capa' and using some C "sizeof" trick? But then it > seems it is still only a saving of 8 bytes per tuple as compared to an > array (I don't think we can remove the 'struct RBasic basic' member). Agreed, we get to save a bit of mem per tuple, not per element. But it could be significant if there's a lot of small tuples... I believe you're thinking about the allocation of space for an object pointer (which is simply taken from the area pointed to by ptr if capa > len), whereas I was talking about the (de)allocation of the "ptr area" itself... As for len & capa... capa would certainly go away, but this is not the main enhancement. IMHO the main gain is never having to realloc() and less memory fragmentation (especially internal). Right now, when an array grows, its capa is increased by 0.5 * capa. -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com Footnotes are for things you believe don't really belong in LDP manuals, but want to include anyway. -- Joel N. Weber II discussing the 'make' chapter of LPG