-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix DmaAllocator memory leak when closing camera
When closing the camera, the allocator was not closing the open file descriptors, causing a memory leak. Fixed by closing the file descriptors and deleting the allocator when closing the camera. Signed-off-by: William Vinnicombe <[email protected]>
- Loading branch information
Showing
5 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/python3 | ||
|
||
# Test that the allocators don't leak | ||
|
||
from picamera2 import Picamera2 | ||
from picamera2.allocators import DmaAllocator, LibcameraAllocator | ||
|
||
for _ in range(200): | ||
picam2 = Picamera2() | ||
picam2.allocator = LibcameraAllocator(picam2.camera) | ||
picam2.configure() | ||
picam2.close() | ||
|
||
for _ in range(200): | ||
picam2 = Picamera2() | ||
picam2.allocator = DmaAllocator() | ||
picam2.configure() | ||
picam2.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters