No such thing as a small change | |
PerlMonks |
Re^3: FFI::Platypus: Replace malloc with GC_MALLOC?by ikegami (Patriarch) |
on Dec 13, 2022 at 13:57 UTC ( [id://11148822]=note: print w/replies, xml ) | Need Help?? |
You picked something that's probably a bit too advanced for that. It involves not just C, but knowledge of FFI and of Perl internals as well, both of which are complex systems.
The answer to the question depends on whether FFI or Perl can free the returned buffer. I think the const in the return type tells FFI to copy the string and avoid freeing it. If so, then yes, you could use a different allocator. I'm guessing that because the example would have problem as-is if FFI or Perl could free the buffer.
In Section
Seekers of Perl Wisdom
|
|