0

I have a C++ app I'm developing in Linux. I'm allocating some dynamic memory and ultimately calling forkpty(). The child process is calling execl() and as we know, execl() never returns if it succeeds to execute the command. Furthermore, as we know, forkpty() makes a copy of all the parent's data. So, if the child() process never returns control back to my application in order to ultimately do memory cleanup, is it safe to say one better not have any dynamic memory allocated at the time execl() is called from the child process??? I can't believe I could not find this one on here... Thanks in advance.

4

2 に答える 2

1

割り当てられたメモリはプロセス イメージの一部です。を呼び出す execlと、プロセス イメージ全体が置き換えられ、その中のメモリは残りの部分と同じように単純に「消えて」OS に戻り、別の場所で使用されます。

于 2013-04-04T13:38:14.107 に答える