Jun-13-2020, 03:21 PM
I don't think garbage collection is the problem here. You get the garbage collection problem when you create an image in a function or method and use a local variable to reference the image. When the function exits all the local variables are deleted, there is nothing referencing the image, and it becomes available for garbage collection. Your code is not doing that. Your variables are not getting deleted, you image variable continues to reference your image, and your image should not get garbage collected.