Python, how to release memory for a class object after processing it?

I use the No keyword to delete a class object.

 class demo:
   class members

 obj= demo()
 some processing
 obj=None

Using No , will memory be freed?

I found that del can also be used to delete a class object. Or should I use

   del obj

to free up memory?

What is the difference between using del and None when deleting a class object and freeing memory or calling garbage collection ?

+4
source share
1 answer

Python , .

obj None .. del obj. , obj .

, obj . ( None), del , NameError. , , , , .

+4

All Articles