Reputation: 41
I have a simple code
import cv2
import numpy as np
Image = cv2.imread('blue.jpg')
Threshold = np.zero
s(Image.shape, np.uint8)
cv2.threshold(Image, 121, 255, cv2.THRESH_BINARY, Threshold)
cv2.imshow("WindowName", Threshold )
cv2.waitKey(0)
cv2.destroyAllWindows()
I want to delete matrix
"Image"
from memeory i.e clear memory to save space in ram
How can i acheive this i am working this code on raspberry pi so
Upvotes: 1
Views: 5301
Reputation: 6121
You may want to use
del Image[:]
del Image
Actually, you don't need to do and even don't need to care about it.
Python automatically frees all objects that are not referenced any more
Refer this with very quality accepted answer how to release used memory immediately in python list?
Upvotes: 0
Reputation: 34205
del Image
will likely do what you want, but there are some special cases.
Image
(it may be freed at some later point, or maybe not at all)del
to be a suggestion.Upvotes: 1