I have a local build of OpenCV on an intel Ubuntu system per these instructions. Nearly identical python, c++, and julia demo programs to capture 1000 images execute mostly as expect. The python and c++ versions work perfectly, but "top" shows that the julia version exhibits a growing use of system memory in tens of MB per second as it runs. If left long enough the system runs out of memory and locks up.
Why does the julia code seem to result in a memory leak and how can I fix that?
using OpenCV
using Printf
cv = OpenCV
function main( )
vidDevice="/dev/video0"
cap = cv.VideoCapture(vidDevice)
count = 1000
while (cv.isOpened(cap) && count > 0)
@printf("Capturing %4d\r", count)
ret,img = cv.read(cap)
count = count - 1
end
cv.release(cap)
cv.destroyAllWindows()
end
main()