I know that when I call one of the exec() system calls in Linux that it will replace the currently running process with a new image. So when I fork a new proces
The entire heap -- allocated memory, and all of the logic malloc
uses to manage it -- is part of the process image which gets
replaced. It simply disappears, as far as your process is
concerned. The system, of course, recovers it and recycles it.