(I confess I haven't looked closely at this yet, but...) I seems that the imp_xxh_t structure is stored in the PVX of an SV pointed to by mg_obj. Is there any reason why it can't be just directly malloced and pointed to from mg_ptr instead?
-- The warp engines start playing up a bit, but seem to sort themselves out after a while without any intervention from boy genius Wesley Crusher. -- Things That Never Happen in "Star Trek" #17