0

I want to delete all objects excepts a few and free up all used memory.

I do not want to delete any loaded packages (using import) though.

In my workspace, there are many objects so it is difficult to delete them manually.

Is there any method available to achieve this? Any pointer will be very helpful.

Bogaso
  • 2,838
  • 3
  • 24
  • 54
  • You can use `del obj1, obj2`, but will need to specify each object you want to delete. Also check [here](https://docs.python.org/3/library/gc.html) on how to explicitly invoke the garbage collector using `inport gc; gc.collect()` – Redox Jul 27 '22 at 09:22
  • Does this answer your question? [How can I explicitly free memory in Python?](https://stackoverflow.com/questions/1316767/how-can-i-explicitly-free-memory-in-python) – Tomerikoo Jul 28 '22 at 07:07

0 Answers0