megengine.coalesce_free_memory

coalesce_free_memory()[source]

This function will try it best to free all consecutive free chunks back to operating system, small pieces may not be returned.

because of the async processing of megengine, the effect of this func may not be reflected immediately. if you want to see the effect immediately, you can call megengine._full_sync after this func was called

Note

  • This function will not move any memory in-use;

  • This function may do nothing if there are no chunks that can be freed.