From: Bil Kleb Date: 2002-01-25T03:16:34+09:00 Subject: Modifying NArray's NVector dumps core? Under certain conditions when we run our numerical simulation code it dumps core as follows: $ ./Advect.rb -s1 ./Vector.rb:13: [BUG] rb_gc_mark(): unknown data type 0x28(0x401ad4b0) non object ruby 1.6.6 (2001-12-26) [i686-linux] Aborted (core dumped) Depending on the parameters we pass to the code via GetoptLong, the code will either consistently run or consistently fail. In addition, the the simulation time until failure will vary; but the location of the failure never changes: line 13 of Vector.rb. Vector.rb defines a wrapper around NVector's constructor and modifies the behavior of it's length and to_s methods, viz, 1 require 'narray' 2 3 # shorthand to create an NVector of floats 4 def Vector(first, *array) 5 NVector[first.to_f, *array] 6 end 7 8 class NVector 9 def length 10 Math.sqrt(self**2) 11 end 12 def to_s 13 to_a.join(' ') # <<<< the failure point 14 end 15 end Right now this is merely an annoyance because we can tweak the simulation paramenters a bit one way or the other and get a completely normal run; but, in Extreme Programming terms, this certainly doesn't smell too good... We are using NArray-0.5.5, and we had the same behavior when using ruby-1.6.5. One more bit of extraneous information: at one point we tried turning off garbage collection and Ruby grew to over 2GB (the size of our machine's memory) in less than 20 seconds and froze our GNU/Linux box. Depending on the grid size of the simulation, Ruby (w/GC) usually only takes 15MB or so... Thanks in advance, -- Bil Kleb NASA Langley Research Center Hampton, Virginia, USA