Here's my code:
import time
import cv2
import mss
import numpy as np
Frame = [0, 0, 1920, 1080]
def GetFrame():
monitor = {"top": Frame[0], "left": Frame[1], "width": Frame[2], "height": Frame[3]}
sct_img = mss.mss().grab(monitor)
return np.asarray(sct_img)
while (True):
inimg = GetFrame()
cv2.imshow("WHY IS MEMORY SO HIGH???????", inimg)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cv2.destroyAllWindows()
When this runs, it doesn't throw any errors, but looking in task manager, my memory fills quickly (after 200 iterations or so), eventually crashing my desktop, then python. I have looked into garbage collection, with no luck.
Python version 3.7.0
MSS version 4.0.1