Function concurrent::gc [] [src]

pub fn gc()

Collect garbage.

This function does two things:

  1. Export garbage from current thread to the global queue.
  2. Collect all the garbage and run destructors on the unused items.

If another thread is currently doing 2., it will be skipped.

Use case

Note that it is not necessary to call this manually, it will do so automatically after some time has passed.

However, it can be nice if you have just trashed a very memory-hungry item in the current thread, and want to attempt to GC it.

Other threads

This cannot collect un-propagated garbage accumulated locally in other threads. This will only attempt to collect the accumulated local and global (propagated) garbage.