Skip to content
Permalink
Browse files

fix(memory_leak): try to fix memory leak

  • Loading branch information...
numb3r3 committed Sep 24, 2019
1 parent fede29c commit 7108460a994491665cca15abd28e92220a6ea66a
Showing with 7 additions and 2 deletions.
  1. +5 −0 gnes/preprocessor/io_utils/video.py
  2. +2 −2 gnes/preprocessor/video/shotdetect.py
@@ -129,6 +129,11 @@ def encode_video(images: 'np.ndarray',
err = '\n'.join([' '.join(cmd_args), err.decode('utf8')])
raise IOError(err)

if proc.stdout is not None:
proc.stdout.close()
if proc.stderr is not None:
proc.stderr.close()

return output


@@ -67,7 +67,7 @@ def detect_shots(self, frames: 'np.ndarray') -> List[List['np.ndarray']]:

shots = []
for ci in range(0, len(shot_bounds) - 1):
shots.append(frames[shot_bounds[ci]:shot_bounds[ci + 1]])
shots.append(frames[shot_bounds[ci]:shot_bounds[ci + 1]].copy())

return shots

@@ -87,7 +87,7 @@ def apply(self, doc: 'gnes_pb2.Document') -> None:
elif raw_type == gnes_pb2.NdArray:
video_frames = blob2array(doc.raw_video)
if self.vframes > 0:
video_frames = video_frames[0:self.vframes, :]
video_frames = video_frames[0:self.vframes, :].copy()

num_frames = len(video_frames)
if num_frames > 0:

0 comments on commit 7108460

Please sign in to comment.
You can’t perform that action at this time.