In article <e7fb8505.0212012224.675c1d3f / posting.google.com>, Squidster wrote:
>Fellow Rubyists/Rubyians/Rubyans,
>
>I have the simple method below for cloning nested arrays, which calls
>the "clone" method for every element of the Array.
>
>class Array
>	def clone
>		klone = []
>		v = nil
>		self.each { |v| klone.push(v.clone) }
>		return klone
>	end 
>end            
>
>This works very well, but consumes memory like crazy and within 10
>minutes my 1GB machine is already swapping (eats about 2MB per
>second)!!
[...]

Perhaps you are trying to clone a "circular" array.

e.g.

a = [1, 2, 3]
a << a
p a 	# -> [1, 2, 3, [...]]

Now a.clone with your clone will go into an infinite loop.

What is the array you are trying to clone?

If it was a "recursion problem" then you would be getting a SystemStackError
exception as (usually?) the maximum stack size for a process is fixed. (See
ulimit.)

-- 
/* gcc -ansi -o sig sig.c -lcrypt */
int main(){int l=0,$=0;char _[8]="To:";while(l-3?(_<:l:>=$++??("#u,UTGK gpFyLY "
#define p(r)p%:%:r("\45\56\52\163",(l=_[3])|7<:_:>%$,crypt(_,_+4%$)|_[6]%$);
"7&nvXD(AqEhsZA`Oh@in #oI.ZX #pXXhe"]):l)++l%8||p(rintf)sorry:gnu_crypt_only:%>