On 3 Dec 2023, at 18:51, John Cowan <[email protected]> wrote: > On Sun, Dec 3, 2023 at 4:45 AM Daphne Preston-Kendal <[email protected]> > wrote: > >> Marc’s proposal seems to be to block the thread until the next garbage >> collection happens to run anyway. Mine is to request an immediate garbage >> collection without ‘blocking’ in that sense. I think mine is the better >> solution since it does not depend on threading to work. > > I don't understand that. In a single-threaded implementation, -try-collect > would have to block, as the mutator and the collector can't run concurrently. > It would be different from -wait only if the collector runs in its own > thread, so it is "dependent on threading".
We do not usually consider garbage collection to be a ‘blocking’ operation in this sense, though. By this definition, every consing procedure is blocking (since a memory allocation that asks for more than is currently available in the memory manager’s pool of free memory is the most common trigger of tracing and freeing in most GCs). Daphne
