One more link
When you fork a process, all of the malloc-heap structures will become COW by virtue of living within privately mapped page contents, which means that you can malloc, then fork, and then safely/correctly free the same pointer in the parent and child process. (Note also that the same rules apply to function returns—a single function call pre-fork can result in two valid returns post-fork with no problems, because the stack and stack management structures will be COWed.) “Required” doesn’t really enter into it TBH; if you no longer need something and it’s allocated usually, free it once you’re in the new process.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.