Jun-05-2020, 03:39 AM
All objects in python have a reference count. When the reference count goes to zero, the memory used by the object is reclaimed. This is called garbage collection. The image you create in method "view_records" is only referenced by the local variable "image". When the method is done, the local variables are deleted and nobody is referencing the image you just created.