On 11/9/09, Ralph Shnelvar <ralphs / dos32.com> wrote: > Newbie here: > > I will want/need to create an array of approximately 300K rows and 20 > columns. The array will be an array of either 32-bit quantities or 64-bit > quantities. > > Does Ruby support native 64-bit quantities? > > What's a good/best way to to create such an array. Is there a way to > tell Ruby, "OK, I'm done with this array." > > Can one create such an array such that the garbage collector can > free the memory in one fast operation? I'm surprised that no-one has yet mentioned narray; I'd think it's the ideal data structure for this kind of problem. (I've never used it, tho.) I'd like to point out that while the memory cost of a Fixnum is small (4 or 8 bytes), the memory cost of a Bignum is considerably larger.... something like 32 bytes or so, even if it's only storing a 64bit value. If you expect a significant number of Bignums to be stored in this array, you should be aware of this. Yet another reason to consider narray, to my mind.