Permalink
Browse files

fixed a bug with vfork and autorelease pools in HDProcess (caused dou…

…ble-free due to how vfork links to vmem which is mutually shared when vfork-ing it seems.) Switched to fork and letting memory be replaced by the kernel at execv-time
  • Loading branch information...
1 parent 3046302 commit e7fad643573e375ce0f3b945a163345c9b928882 @rsms committed Dec 20, 2010
Showing with 1 addition and 5 deletions.
  1. +1 −5 HDProcess.m
View
@@ -255,12 +255,11 @@ - (void)start {
char **saved_env = environ;
// vfork & execvp
- pid_ = vfork();
+ pid_ = fork();
if (pid_ == -1) {
[NSException raise:NSInternalInconsistencyException format:@"vfork()"];
} else if (pid_ == 0) {
// child
- NSAutoreleasePool *pool = [NSAutoreleasePool new];
// close parent end of pipes and assign our stdio to our end
close(stdin_pipe[1]); // close write end
@@ -318,9 +317,6 @@ - (void)start {
_argv[0] = strdup(file);
}
- // drain autoreleased stuff
- [pool drain];
-
// switch process image
execvp(file, argv);

0 comments on commit e7fad64

Please sign in to comment.