Skip to content

fix: use context manager for file read in pack_data - #1

Open
haosenwang1018 wants to merge 1 commit into
open-gigaai:mainfrom
haosenwang1018:fix/file-handle-leak
Open

fix: use context manager for file read in pack_data#1
haosenwang1018 wants to merge 1 commit into
open-gigaai:mainfrom
haosenwang1018:fix/file-handle-leak

Conversation

@haosenwang1018

Copy link
Copy Markdown

Replace open().read() with with open() as f: f.read() in the data packing loop. When processing many videos, unclosed file handles can exhaust file descriptors.

open().read() without context manager leaks file descriptor until GC.
In a loop processing many video files this can exhaust file descriptors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant