in reply to Mark-and-sweep-like mechanism to verify refcount integrity
A cheesy but possibly effective way to solve this problem is build a custom version of Perl that allows you to log all calls to increment/decrement a particular variable. Install that in a custom location, recompile all of your XS modules against that, and see what you get.
Glancing at the code, you'd want to redefine SvREFCNT_inc and SvREFCNT_dec in sv.h. The latter is easier to add custom logic to - it calls sv_free in sv.c so you can edit that. The former is an inline macro that may be harder to edit.
From an uninformed glance at the code, if you want a custom per-scalar flag the sv_flag's struct has 8 more flags available: 0x00000010, 0x00000020, 0x00000040, 0x00000080, 0x00000001, 0x00000002, 0x00000004, and 0x00000008. However seeing how much work is going into avoiding using those makes me suspect that someone, somewhere uses them in a way that is not obvious to me.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Mark-and-sweep-like mechanism to verify refcount integrity
by nobull (Friar) on Oct 06, 2004 at 10:55 UTC |