Sorry, just saw this now. To make sure this is related to object lifetime, you could try running it without the garbage collector (GC.enable(false)
).
Reading this thread I think you might need to use GC.@preserve
in the line that defines sqvals
, it seems the compiler might think here that brv
is no longer needed.