poke-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 4/5] Disable the GC at exit if GC_remove_roots absent


From: Jose E. Marchesi
Subject: Re: [PATCH 4/5] Disable the GC at exit if GC_remove_roots absent
Date: Fri, 26 Mar 2021 09:43:43 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> I suspect that the lack of GC_remove_roots is causing the segmentation
> fault during pk_compiler_free. This may or may not be indicative of
> deeper issues.

You suspect right: due to the way we use the GC roots in the AST nodes
(I have a half baked patch fixing that) if GC_remove_roots is not
invoked every time an AST node for an array type or struct type is
destroyed, the collector will ran out of them.

>
> 2021-03-25  Georgiy Tugai  <georgiy@crossings.link>
>
>       * poke/poke.c (finalize): GC_disable just before compiler cleanup
> ---
>  ChangeLog   | 4 ++++
>  poke/poke.c | 4 ++++
>  2 files changed, 8 insertions(+)
>
> diff --git a/ChangeLog b/ChangeLog
> index 2a115b12..5b6c3abd 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,7 @@
> +2021-03-25  Georgiy Tugai  <georgiy@crossings.link>
> +
> +     * poke/poke.c (finalize): GC_disable just before compiler cleanup
> +
>  2021-03-25  Georgiy Tugai  <georgiy@crossings.link>
>
>       * .gitignore: exclude gl-libpoke/Makefile.am
> diff --git a/poke/poke.c b/poke/poke.c
> index 6343726d..0b009c38 100644
> --- a/poke/poke.c
> +++ b/poke/poke.c
> @@ -26,6 +26,7 @@
>  #include <string.h>
>  #include <locale.h>
>  #include <textstyle.h>
> +#include <gc/gc.h>
>  #include "xalloc.h"
>  #include <assert.h>
>
> @@ -295,6 +296,9 @@ finalize (void)
>  #endif
>    pk_cmd_shutdown ();
>    pk_map_shutdown ();
> +#ifndef HAVE_GC_REMOVE_ROOTS
> +  GC_disable ();
> +#endif
>    pk_compiler_free (poke_compiler);
>    pk_term_shutdown ();
>  }

Please add a pvm_alloc_disable_gc function to pvm-alloc.[ch] and use it
in poke.c.

Also, note we generally prefer

#if !defined FOO

to

#ifndef FOO



reply via email to

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