what about a mem leak in a child process
Im on unix platform.
The memory of a process with a memleak is cleaned at process termination.
What about a pr开发者_开发技巧ocess, that has spawned a child, where the child has a memleak. Will the leaked memory be cleaned up at childprocess termination? Or will this memory now stick with the parent process.
Thanks
The memory allocated by the child process exists only in the child process's virtual address space, not the parent's. It will be freed as soon as the child process terminates or replaces itself with a new program image via one of the exec
family of functions.
This is in contrast to threads, which share a common virtual address space, and where allocations made in a new thread will persist after the thread exits and remain usable by other threads.
精彩评论