Skip to content
Permalink
Browse files

fix(memory-leak): try to fix memory leak danger

  • Loading branch information...
numb3r3 committed Oct 10, 2019
1 parent 16097f3 commit 9b79cdf52aeca1ef4999b6ef306a816b9ad9dfbe
Showing with 6 additions and 5 deletions.
  1. +2 −2 gnes/preprocessor/io_utils/gif.py
  2. +2 −2 gnes/preprocessor/io_utils/video.py
  3. +2 −1 gnes/proto/__init__.py
@@ -58,8 +58,8 @@ def capture_frames(input_fn: str = 'pipe:',
if pix_fmt == 'rgba':
depth = 4

frames = np.frombuffer(out,
np.uint8).reshape([-1, height, width, depth])
frames = np.frombuffer(out, np.uint8).copy()
frames = frames.reshape([-1, height, width, depth])
return frames


@@ -219,8 +219,8 @@ def capture_frames(input_fn: str = 'pipe:',
if pix_fmt == 'rgba':
depth = 4

frames = np.frombuffer(out,
np.uint8).reshape([-1, height, width, depth])
frames = np.frombuffer(out, np.uint8).copy()
frames = frames.reshape([-1, height, width, depth])
return frames


@@ -91,7 +91,8 @@ def blob2array(blob: 'gnes_pb2.NdArray') -> np.ndarray:
"""
Convert a blob proto to an array.
"""
return np.frombuffer(blob.data, dtype=blob.dtype).reshape(blob.shape)
x = np.frombuffer(blob.data, dtype=blob.dtype).copy()
return x.reshape(blob.shape)


def array2blob(x: np.ndarray) -> 'gnes_pb2.NdArray':

0 comments on commit 9b79cdf

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