On this page
article
Force Garbage Collection
Manually trigger garbage collection.
Category: gc
Problem
Manually trigger garbage collection.
Solution
gc.collect()
Notes
- Adapt variable names and paths to your project
- Add error handling for production use
- See related chapters in the Learning Path