Re: SOLVED: Was Garbage collector - ccl:terminate (memory stuff)
Grégory Vanuxem <[email protected]> Sat, 1 Jun 2024 04:47:50 +0200
| Newsgroups | gmane.lisp.openmcl.devel |
|---|---|
| Message-ID | <CAHnU2dajw=5B6yBCfqa=_T29fFsd9yN_9R7hwDYpMAWsT=c+SA@mail.gmail.com> |
Hello Matthew, *, Le ven. 31 mai 2024 =C3=A0 20:33, R. Matthew Emerson <[email protected]> a = =C3=A9crit : > > > > > On May 22, 2024, at 2:22=E2=80=AFPM, Gr=C3=A9gory Vanuxem <g.vanuxem@gm= ail.com> wrote: > > > > Hi Robert, hi all, > > > > Many thanks for your reply. It allowed me to go further into this and > > I have found a solution. > > > > In the FriCAS context, the email, I just sent to the FriCAS mailing lis= t: > > https://groups.google.com/g/fricas-devel/c/kHMffXyMIB0/m/hMh1mMasBQAJ > > > > Basically FriCAS create a simple fricas-class application: > > > > (defclass fricas-application (ccl::application) ()) > > It looks a bit odd that you are inheriting from ccl::application here, ye= t in your toplevel-function method below, you create an instance of ccl::li= sp-development-system. I=E2=80=99m somewhat surprised that works for you. It is not my code. It was inspired by old code from what I know. Since then Clozure CL has evolved. > > > > and use it at startup: > > > > (defmethod ccl::toplevel-function ((app fricas-application) init-file) > > [snippet] > > (funcall *my-toplevel-function*) > > (let ((ap (make-instance 'ccl::lisp-development-system))) > > (ccl::toplevel-function ap init-file))) > > > > And, basically, the fricas-application (FiCAS) when > > > > (CCL::save-application core-image > > :PREPEND-KERNEL t > > :application-class 'fricas-applica= tion) > > > > Does not execute ccl:terminate, you have to return (start) to the > > "main" thead/process to allow CCL to execute the terminate method. > > What does *my-toplevel-function* do? If it=E2=80=99s just some additiona= l initialization, maybe you could put a :before method on toplevel-function= (application t) instead? It's removed now. The diff is here, sorry I forgot to mention it: https://github.com/fricas/fricas/commit/188e633ff90e0140d2a15afcd89d8dfa79f= 95ccb#diff-ef5e3194150e5f7307ca93cf74c3a798b97591d64fa2048330d4760c77e97c87 It's just a lambda form. I will give it a try, thanks. I find this "issue" a little boring, having an apparently stalled thread. > In the method toplevel-function (ccl::lisp-development-system t) > > https://github.com/Clozure/ccl/blob/19906f6afdff4dbf232f560a4d13a81da65da= f5f/level-1/l1-application.lisp#L284 > > we start a loop that calls the function called ccl::housekeeping a few ti= mes a second. One of the housekeeping tasks is to run gc hook functions. = (The hook functions are managed via ccl::add-gc-hook and ccl::remove-gc-hoo= k.) > > https://github.com/Clozure/ccl/blob/19906f6afdff4dbf232f560a4d13a81da65da= f5f/level-1/l1-events.lisp#L166 > > As you may suspect by now, the way termination functions get called is vi= a a gc hook. So, if the housekeeping loop doesn=E2=80=99t run for some reas= on, then automatic termination won=E2=80=99t work. > > If you can=E2=80=99t run the housekeeping loop, I think it would work to = call ccl:drain-termination-queue manually as needed. Very interesting, I have not noticed this. Best regards, - Greg