SciRuby/nmatrix — pull request #128 by cjfuller (2013-09-09 05:22:21+00:00)
Title: Fix #126 (segfault in elementwise operations)

The gc mark function for the various storage functions was using its argument as a storage pointer when in fact it was a NMATRIX pointer. This led to incorrect dtype being read out, and the marking ignored. Object-dtype nmatrices created as intermediates in the various map functions involved in elementwise operations were therefore garbage collected before being used, causing the segfault in #126.

I can write a spec for this as well, but the issue is that I have no clue how to do it without actually causing the segfault when the spec fails, which is probably not ideal. Any ideas on how to gracefully detect a segfault from rspec, or otherwise read out whether the marking is working properly?