in reply to Re^2: FFI::Platypus: Replace malloc with GC_MALLOC?
in thread FFI::Platypus: Replace malloc with GC_MALLOC?

I'm just trying to improve my poor C knowledge.

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.

Is [replacing malloc with GC_MALLOC] recommended or will it cause problems in the future not yet imaginable now?

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.