While del
can make an object eligible for garbage collection by reducing its reference count, it does not force the garbage collector to run immediately and reclaim the memory.
Besides, calling clear()
on a container can indeed make the objects it previously held eligible for garbage collection, provided they are not referenced by any other part of the program.