guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/03: gnu: guile@3.0.8: Add patch to address continuation memory leak.


From: guix-commits
Subject: 02/03: gnu: guile@3.0.8: Add patch to address continuation memory leak.
Date: Sun, 6 Nov 2022 06:39:15 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 7138ba34fa11d3eb2d9e7e44771e698f53415dbc
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sun Nov 6 12:32:58 2022 +0100

    gnu: guile@3.0.8: Add patch to address continuation memory leak.
    
    * gnu/packages/patches/guile-continuation-stack-leak.patch: New patch.
    * gnu/local.mk (dist_patch_DATA): Add it.
    * gnu/packages/guile.scm (guile-3.0-latest)[source]: Use it.
---
 gnu/local.mk                                       |  1 +
 gnu/packages/guile.scm                             |  3 ++-
 .../patches/guile-continuation-stack-leak.patch    | 27 ++++++++++++++++++++++
 3 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index bce2332579..f39277dfa1 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1274,6 +1274,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/guile-linux-syscalls.patch              \
   %D%/packages/patches/guile-3.0-linux-syscalls.patch          \
   %D%/packages/patches/guile-ac-d-bus-fix-tests.patch          \
+  %D%/packages/patches/guile-continuation-stack-leak.patch     \
   %D%/packages/patches/guile-cross-compilation.patch           \
   %D%/packages/patches/guile-fibers-destroy-peer-schedulers.patch \
   %D%/packages/patches/guile-fibers-epoll-instance-is-dead.patch \
diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index fcdf75051c..322debac71 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -399,7 +399,8 @@ without requiring the source code to be rewritten.")
               (sha256
                (base32
                 "04wagg0zr0sib0w9ly5jm91jplgfigzfgmy8fjdlx07jaq50d9ys"))
-              (patches (search-patches "guile-cross-compilation.patch"))))
+              (patches (search-patches "guile-cross-compilation.patch"
+                                       
"guile-continuation-stack-leak.patch"))))
     (arguments
      (substitute-keyword-arguments (package-arguments guile-3.0)
        ;; Guile 3.0.8 is bit-reproducible when built in parallel, thanks to
diff --git a/gnu/packages/patches/guile-continuation-stack-leak.patch 
b/gnu/packages/patches/guile-continuation-stack-leak.patch
new file mode 100644
index 0000000000..0e57b7bb4e
--- /dev/null
+++ b/gnu/packages/patches/guile-continuation-stack-leak.patch
@@ -0,0 +1,27 @@
+This patch fixes a memory leak when capturing and resuming delimited
+continuations intensively, as is the case with the Shepherd 0.9+:
+
+  https://issues.guix.gnu.org/59021
+
+diff --git a/libguile/vm.c b/libguile/vm.c
+index 6fd5c554f..516bae773 100644
+--- a/libguile/vm.c
++++ b/libguile/vm.c
+@@ -165,11 +165,13 @@ capture_stack (union scm_vm_stack_element *stack_top,
+                scm_t_dynstack *dynstack, uint32_t flags)
+ {
+   struct scm_vm_cont *p;
++  size_t stack_size;
+ 
+-  p = scm_gc_malloc (sizeof (*p), "capture_vm_cont");
+-  p->stack_size = stack_top - sp;
+-  p->stack_bottom = scm_gc_malloc (p->stack_size * sizeof (*p->stack_bottom),
+-                                   "capture_vm_cont");
++  stack_size = stack_top - sp;
++  p = scm_gc_malloc (sizeof (*p) + stack_size * sizeof (*p->stack_bottom),
++                     "capture_vm_cont");
++  p->stack_size = stack_size;
++  p->stack_bottom = (void *) ((char *) p + sizeof (*p));
+   p->vra = vra;
+   p->mra = mra;
+   p->fp_offset = stack_top - fp;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]