While working on some Rails apps for RollStream and using Mauricio Fernandez's excellent rcov plugin we started to encounter the [BUG] rb_gc_mark(): unknown data type problem. We only saw this when we ran our controller tests; just running the unit tests wouldn't trigger it. It was a bummer, though, because we couldn't see where we were coverage-wise.
I poked around rcov for a while using Valgrind - there's no Mac OS X port, but I had a Linux VMWare Fusion instance handy. After some flailing around I finally hit paydirt. This Valgrind invocation:
turned up this problem report:
rcovt.c line 103 involves usage of a cov_array struct; I added some bounds checking like so:
I rebuilt the gem, reran the coverage task, and huzzah! It completes!
This isn't a great fix, of course - I'd much rather figure out what's wrong with the allocation of cached_array. Perhaps someone cleverer than I can come up with a better fix.
Updated 8/27/08: Modified to document a better fix - check the cached_array->len attribute and compare it to the sourceline.