maybe that's what you're looking for:
https://dlang.org/phobos/core_memory.html#.GC.collect
What is nice with Nim it that it has a GC heap PER THREAD. No
need to stop the other threads during a GC...
https://nim-lang.org/docs/threads.html
https://nim-lang.org/docs/manual.html#threads
"Nim's memory model for threads is quite different than that of
other common programming languages (C, Pascal, Java): Each thread
has its own (garbage collected) heap and sharing of memory is
restricted to global variables. This helps to prevent race
conditions. GC efficiency is improved quite a lot, because the GC
never has to stop other threads and see what they reference.
Memory allocation requires no lock at all! This design easily
scales to massive multicore processors that are becoming the
norm."
I'd suggest taking inspiration from that for D's memory
allocations and garbage collection...