Yes - I think that makes sense, and I find that if I first
#undef free, then I can successfully call free(). I wonder what sort of trouble one could get into by doing that. (I think I would prefer to use the external library's freeing routine, assuming such exists.)
Further to
ikegami's suggestion that this type of "Free to wrong pool..." error occurs with threaded perls (which I've since confirmed as correct for Win32), I decided to build a threaded perl on linux. But, on linux, there was no such error with either a "threaded" or "unthreaded" build of perl. As best I can tell, it's a Win32-only problem, but only if perl was built with threads capability.
Thanks for the thoughts, guys - I appreciate your insight.
Cheers,
Rob