-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm writing an XSUB interface to a third-party API and learning things about XS and perl internals as I do so. This API allocates some memory buffers using its internal memory-management functions, and it expects its caller to free the buffers using another call in the interface. I'd like to be able to pass the buffer directly to Perl callers, but I can't tell from the documentation whether Perl copies the buffer when I use newSVpvn(), or not, and whether Perl is going to attempt to free() the buffer when the scalar is GC'd. I'm currently using New() and memcpy()ing the buffers for safety purposes, then immediately freeing those buffers allocated by the API, but I'd like to be more efficient. Ideally, I'd like to hook the DESTROY of the buffer's SV and call my API's free() function at that time, but I'm not familiar enough with all the ins and outs to know whether this is feasible. Suggestions? Thanks, Randy -----BEGIN PGP SIGNATURE----- Version: PGP 7.0.1 iQA/AwUBO2CHpFy3t/KgqlweEQJM8ACgneQk72adiI4pgCyhmEyJJFBGs/MAn3Gz T+Hl6K3scZ/c45tawQ5J1/zv =PCNQ -----END PGP SIGNATURE-----
