~ chicken-core (chicken-5) 02e243abc86c35e129b7db9cf5f9f184100c88ca


commit 02e243abc86c35e129b7db9cf5f9f184100c88ca
Author:     Peter Bex <peter@more-magic.net>
AuthorDate: Fri Nov 10 21:38:04 2017 +0100
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Mon Dec 4 19:21:00 2017 +0100

    Similar to 118fce and 596332, clean up old state upon fork
    
    When fork receives a thunk to run in the child process, call it with a
    clean, empty continuation rather than keeping any cruft from the
    parent around.
    
    This should allow GC of objects that are no longer necessary and
    improve memory use somewhat, and perhaps prevent situations like
    that in #1367 when using processes instead of threads.
    
    Signed-off-by: felix <felix@call-with-current-continuation.org>

diff --git a/posixunix.scm b/posixunix.scm
index 9304b395..11a00e07 100644
--- a/posixunix.scm
+++ b/posixunix.scm
@@ -1564,8 +1564,10 @@ EOF
 		 ##sys#kill-other-threads
 		 (lambda (thunk) (thunk)))
 	     (lambda ()
-	       (thunk)
-	       (exit 0)))
+	       (##sys#call-with-cthulhu
+		(lambda ()
+		  (thunk)
+		  (exit 0)))))
 	    pid)))))
 
 (define (process-execute filename #!optional (arglist '()) envlist)
Trap