Hi,
Is there a POSIX function equivalent to _malloc_r and _free_r from CYGWIN? Is there a POSIX reentrant library?
Please advice.
Many thanks.
Hi,
Is there a POSIX function equivalent to _malloc_r and _free_r from CYGWIN? Is there a POSIX reentrant library?
Please advice.
Many thanks.
No, and for good reason. Demanding reentrancy of malloc
, even if only for special _r
functions, would impose massive performance costs and likely precludes many high-performance implementations to begin with. Why do you need reentrancy? If you're trying to allocate memory from a signal handler, you might use mmap
, but a better approach would be moving as much code as possible out of the signal handler and using the signal handler itself only to set a flag that will get picked up by another part of your program after the signal handler returns.