Skip to content

Commit e2f4bd0

Browse files
committed
sapi/was: skip shutdown unless FREE_AT_EXIT is set
The whole cleanup procedure is correct but is usually useless overhead. When you have ten thousand processes all shutting down at the same time, that may take a while. Let's skip this, but leave an option to re-enable this by setting the environment variable FREE_AT_EXIT=1 (similar to Ruby's "RUBY_FREE_AT_EXIT" environment variable).
1 parent 8441ab3 commit e2f4bd0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sapi/was/was_main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,9 @@ RunWas(struct was_simple *w)
711711
return false;
712712
}
713713

714+
if (getenv("FREE_AT_EXIT") == NULL)
715+
_exit(EXIT_SUCCESS);
716+
714717
return true;
715718
}
716719

@@ -749,6 +752,9 @@ RunMultiWas(struct was_multi *m)
749752
was_simple_free(w);
750753
}
751754

755+
if (getenv("FREE_AT_EXIT") == NULL)
756+
_exit(EXIT_SUCCESS);
757+
752758
sigaction(SIGCHLD, &old_sigchld, NULL);
753759
return true;
754760
}

0 commit comments

Comments
 (0)