- 论坛徽章:
- 0
|
关于UNIX下使用execvp的问题
man 2 execve
execve() does not return on success, and the text, data, bss, and stack of the calling process are overwritten by that of the program loaded. The program invoked inherits the calling process's PID, and any open file descriptors that are not set to close on exec. Signals pending on the calling process are cleared. Any signals set to be caught by the calling process are reset to their default behaviour. The SIGCHLD signal (when set to SIG_IGN) may or may not be reset to SIG_DFL.
第一:
不光是数据段,SS也一样。
第二:
用malloc获得的内存在堆中,释放的途径有两种
a) free
b) 该进程退出
所以为了不产生泄漏,当然要free之。但是好像没有什么好办法去free.不知道你为什么要把这些参数保存在堆中。完全没必要。 |
|