[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: using finalizers
From: |
Tomas Hlavaty |
Subject: |
Re: using finalizers |
Date: |
Sun, 02 Jan 2022 00:05:46 +0100 |
On Sat 01 Jan 2022 at 15:55, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>>> My original issue did not run the finalizer because of a bug in my use
>>> of letrec. Unless there is a good way to actually trigger the
>>> finalizer, there is no good way to test such code paths. Or shall the
>>> programmers just hope for the best?
>
> Calling `garbage-collect` should usually work well enough for tests
good, thanks
> (tho this may have to be tweaked if/when we get a fancier GC), tho
> there's always the risk that some bitpattern somewhere inside the stack
> happens to look like a pointer to your finalizer (or an object that
> transitively references it), so no I don't know of a way to *reliably*
> get a finalizer to run.
>
> You can minimize the risk of a bitpattern getting in the way by trying
> to trigger a GC at a point where the C stack is as small as possible,
> but it still can't rule out the problem completely.
What does "trigger a GC at a point where the C stack is as small as
possible" mean? Does it mean trigger gc explicitly from top level?
- Re: using finalizers, (continued)
Re: using finalizers, Tomas Hlavaty, 2022/01/01
Re: using finalizers, Tomas Hlavaty, 2022/01/01
Re: using finalizers, Tomas Hlavaty, 2022/01/01
Re: using finalizers, Tomas Hlavaty, 2022/01/01
- Re: using finalizers, Eli Zaretskii, 2022/01/02
- Re: using finalizers, Tomas Hlavaty, 2022/01/02
- Re: using finalizers, Eli Zaretskii, 2022/01/02
- Re: using finalizers, Tomas Hlavaty, 2022/01/02
- Re: using finalizers, Eli Zaretskii, 2022/01/02
- Re: using finalizers, Eli Zaretskii, 2022/01/02
- Re: using finalizers, Tomas Hlavaty, 2022/01/02