Igor Sysoev
2006-04-05 20:02:50 UTC
Hi,
is the effective way to return data from XS to perl without unnecessary
memory coping ? As I understand
1) if I return char*, then perl creates SV and copies the string to SV.
2) if I create SV using newSVpvn() and return it, then newSVpvn() copies
string to SV, then perl creates another SV (because my SV is mortal)
and again copies the string to its SV.
If I need to pass data with '\0's, then I have to use second way with
two copy operations. Is there way to set pointers only ?
And is there way to concatenate two memory blocks into one SV
using minumum copy operations ?
Igor Sysoev
http://sysoev.ru/en/
is the effective way to return data from XS to perl without unnecessary
memory coping ? As I understand
1) if I return char*, then perl creates SV and copies the string to SV.
2) if I create SV using newSVpvn() and return it, then newSVpvn() copies
string to SV, then perl creates another SV (because my SV is mortal)
and again copies the string to its SV.
If I need to pass data with '\0's, then I have to use second way with
two copy operations. Is there way to set pointers only ?
And is there way to concatenate two memory blocks into one SV
using minumum copy operations ?
Igor Sysoev
http://sysoev.ru/en/