Re: [Sbcl-devel] [Sbcl-bugs] Passing `:dont-save t` to `sb-ext:finalize` has no effect

8 views
Skip to first unread message

Douglas Katzman via Sbcl-devel

unread,
Oct 23, 2023, 4:59:36 PM10/23/23
to lis...@qq.com, sbcl-...@lists.sourceforge.net, sbcl...@lists.sourceforge.net


On Sun, Oct 22, 2023 at 10:45 PM lisexp--- via Sbcl-bugs <sbcl...@lists.sourceforge.net> wrote:

After our previous discussion, I made sure to pass the `:dont-save t`
parameter to all calls to `sb-ext:finalize`. However, I have noticed
that this parameter does not have the desired effect

This is a race between the GC deciding to trigger a finalizer (placing it on the pending execution queue) and deleting the dont-save finalizers. Theoretically your example could run that finalizer before creating the "test" executable because it knows that the finalized object is dead; but unfortunately the system is not in a state to run actions at that point.  I think the best we can do is discard the finalizer so that's what I'll make it do.
Have you found a case where :dont-save does not behave as expected but it's NOT related to a subtle timing issue?

I also think there's a bug about running a finalizer more than once, but I think it's unrelated. I do not have a reproducer. I only noticed it when your example printed "I'm finalized" twice in a row.

Douglas Katzman via Sbcl-devel

unread,
Oct 24, 2023, 1:34:05 PM10/24/23
to lis...@qq.com, sbcl-...@lists.sourceforge.net, sbcl...@lists.sourceforge.net
On Mon, Oct 23, 2023 at 4:58 PM Douglas Katzman <do...@google.com> wrote:

I also think there's a bug about running a finalizer more than once, but I think it's unrelated. I do not have a reproducer. I only noticed it when your example printed "I'm finalized" twice in a row.
This turns out to be related to calling FORMAT in a finalizer.  If the main thread flushes *STANDARD-OUTPUT* at the same time as the finalizer, it's possible to get double output.  So I am no longer worried.
Reply all
Reply to author
Forward
0 new messages