-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
According to POSIX, memory allocation using malloc (and thus new inherently as well) is not a safe operation after a fork call, because libc may have been allocating memory in another thread and so could have some mutexes locked, which would deadlock the child.
See this article for a nice explanation:
http://www.linuxprogrammingblog.com/threads-and-fork-think-twice-before-using-them
Unfortunately Poco::Process::launch() implementation does allocate memory at least in two places I've seen so far:
https://github.com/pocoproject/poco/blob/develop/Foundation/src/Process_UNIX.cpp#L184
https://github.com/pocoproject/poco/blob/develop/Foundation/src/Environment_UNIX.cpp#L63-L65
(called from https://github.com/pocoproject/poco/blob/develop/Foundation/src/Process_UNIX.cpp#L167 )