Skip to content

Commit

Permalink
Close DmaHeap when closing DmaAllocator
Browse files Browse the repository at this point in the history
The DmaHeap file descriptor wasn't being closed when the DmaAllocator
was closed, resulting in a leak of file descriptors.

Signed-off-by: William Vinnicombe <[email protected]>
  • Loading branch information
will-v-pi committed Feb 20, 2024
1 parent e6c6d92 commit b6dce4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions picamera2/allocators/dmaallocator.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def close(self):
os.close(fd)
self.frame_buffers = {}
self.open_fds = []
self.dmaHeap.close()

def __del__(self):
self.close()
Expand Down
3 changes: 3 additions & 0 deletions picamera2/dma_heap.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,6 @@ def alloc(self, name, size) -> UniqueFD:
return UniqueFD()

return allocFd

def close(self):
os.close(self.__dmaHeapHandle.get())

0 comments on commit b6dce4f

Please sign in to comment.