Closed flowln closed 9 months ago
I had made similar fixes to this PR but with some cleanup and additional features. These were done in these commits:
86e30c22232fe9a09179473aa7f96cc4cd94bef8
78781ddeacd8700b428950d5a815d230c619aa71
48e14a63b662d6c2c1b2cd3e860bbadd30342e08
bb49af432db3a70963df3bd7adcca7786e3bf62d
Previously, when using the Capture mode, if you started a new capture without saving the previously captured frames to a file, the
pCapture
array holding the frames wouldn't be free'd properly, causing a memory leak. Another way of causing such leak was by changing the capture mode to stream without saving the frames to a file.With this commit, when resetting
NDFileNumCaptured
before starting a new capture, we make sure to also empty the capture buffer if it is not empty yet, so that no buffer is leaked.I used Valgrind to try to make sure there'd be no other way of reaching those
NDArray
s held inpCapture
after overriding it or settingNDFileModeCapture
to zero, but sorry if I missed something! :slightly_smiling_face: