Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up gc-hook mechanisms #453

Open
svspire opened this issue Aug 1, 2023 · 0 comments
Open

Clean up gc-hook mechanisms #453

svspire opened this issue Aug 1, 2023 · 0 comments

Comments

@svspire
Copy link
Contributor

svspire commented Aug 1, 2023

MCL had a mechanism for automatically executing user code both before and after a garbage collection via the variables *pre-gc-hook*, *post-gc-hook*, and the functions #'add-gc-hook and #'remove-gc-hook.

CCL no longer seems to support *pre-gc-hook* although it does continue to support *post-gc-hook*. In CCL, adding a function to *pre-gc-hook* (either directly or by calling #'add-gc-hook with an argument of :pre-gc) is effectively a no-op because no current CCL code pays any attention to *pre-gc-hook*.

I don't know for sure why *pre-gc-hook* is no longer supported but I can speculate: Running user code at pre-gc time is asking for trouble because by definition that code runs when the system is out of memory. Supporting *post-gc-hook* on the other hand is easy.

I suspect that *pre-gc-hook* remains in the code only for backward compatibility with MCL.

I propose the following:

  1. We document how *post-gc-hook* works (since it's never been properly documented) and make it clear that there's no longer any such thing as *pre-gc-hook*.
  2. We remove all code that defines and supports *pre-gc-hook* from the code base. I rather doubt there's any old MCL code being run in CCL that depends on it. MCL itself seemed to stop supporting it around version 4.3 or even before. (I say this because a very old MCL example file called #P"edit-callers.lisp" was changed to no longer use *pre-gc-hook* around version 4.3. I don't have complete source code for those old versions so I can't say for sure when that variable stopped being read.)
  3. We remove the file #P"ccl:library;macptr-termination.lisp" because it doesn't get loaded by anybody any more. It seems to be an MCL-specific file. Am I wrong about this?

Comments welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant