Skip to content
Discussion options

You must be logged in to vote

If you're writing an application and you really want to kick off a GC run, just call GC.Collect(). That said, it's rare you should need to manually trigger a GC run.

If you're writing a library or application that interfaces with native memory, use that API.

If you're deploying (or possibly writing) an application, and you want to make the GC possibly more aggressive, consider setting configuration in the runtime config. If you're deploying in a docker container, setting the limits on the container definition is also an option. If you're writing a library, do neither, but you might consider informing users about memory behavior.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by WeihanLi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants