From 7d683ef39979dd3d458decf7a5e95ac1394db4bd Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Sun, 11 Oct 2020 09:48:40 -0500 Subject: [PATCH] cleanup frame queue --- detect_objects.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/detect_objects.py b/detect_objects.py index ee2749fb4..751ea4622 100644 --- a/detect_objects.py +++ b/detect_objects.py @@ -303,8 +303,15 @@ def main(): event_processor.join() object_processor.join() camera_watchdog.join() - for camera_process in camera_processes.values(): + for camera_name, camera_process in camera_processes.items(): camera_process['capture_thread'].join() + # cleanup the frame queue + while not camera_process['frame_queue'].empty(): + frame_time = camera_process['frame_queue'].get() + shm = mp.shared_memory.SharedMemory(name=f"{camera_name}{frame_time}") + shm.close() + shm.unlink() + for detector in detectors: detector.stop() for shm in camera_shms: