From 3201e71f400168076cf3a99b74ff2b167e31d5d6 Mon Sep 17 00:00:00 2001 From: Pier Angelo Vendrame Date: Tue, 21 May 2019 20:52:46 +0200 Subject: [PATCH] Fixed memory leak that happened when calling apply Registration.apply caused a memory leak because Frame.create did not associate freenect2_frame_dispose to the garbage collector. --- freenect2/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/freenect2/__init__.py b/freenect2/__init__.py index 9946613..bb5a1de 100644 --- a/freenect2/__init__.py +++ b/freenect2/__init__.py @@ -346,7 +346,8 @@ def create(self, width, height, bytes_per_pixel): attributes are initialised. """ - return Frame(lib.freenect2_frame_create(width, height, bytes_per_pixel)) + frame_ref = lib.freenect2_frame_create(width, height, bytes_per_pixel) + return Frame(ffi.gc(frame_ref, lib.freenect2_frame_dispose)) def to_image(self): """Convert the Frame to a PIL :py:class:`Image` instance."""