On Fri, 7 Aug 2020 06:23:52 -0700 (PDT), "'Joel Dueck' via Racket Users" <racket-users@googlegroups.com> wrote:
>On Wednesday, August 5, 2020 at 10:44:21 AM UTC-5 Sam Tobin-Hochstadt wrote: > >> Here's a benchmark of your two functions that takes long enough to run >> that it avoids some of these issues, and also runs a GC before >> benchmarking: https://gist.github.com/7cb4645308d8572e2250833ef7b90b7c >> > >What is the reason for calling `collect-garbage` twice consecutively? It is an attempt to start with the cleanest heap possible. Objects that have a "finalizer" get collected over 2 GC cycles - the finalizer function gets run during the 1st collection, and then the object memory is reclaimed during the next collection. Running GC twice makes sure any finalized objects have been collected. Also, when GC can run in parallel with the mutator, it is possible to miss collecting objects that become garbage *while* GC is running. This can't happen in BC Racket, but it might be possible in RacketCS because Chez has a different thread model. ??? >Also, the docs are unclear on this, but is `(collect-garbage)` equivalent >to `(collect-garbage 'major)` ? The docs clearly state that the default is 'major. (collect-garbage [request]) ? void? request : (or/c 'major 'minor 'incremental) = 'major George -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/tp8sifhd4c0cdlvk22qfsmksckv5r0ajpq%404ax.com.