<p></p>
<p>One more <a href="https://www.reddit.com/r/cprogramming/comments/57pg5s/dynamically_allocated_memory_and_fork/" rel="nofollow">link</a></p>
<blockquote>
<p>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.</p>
</blockquote>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/2892#issuecomment-948523991">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZLOOC7U53QG56HGSZ3UH73MTANCNFSM5GNTLMKQ">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<img src="https://github.com/notifications/beacon/ABO7UZN6NWREJTIBUBQYUHTUH73MTA5CNFSM5GNTLMK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHCEVHVY.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/2892#issuecomment-948523991",
"url": "https://github.com/kamailio/kamailio/issues/2892#issuecomment-948523991",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>