JuliaIO / VideoIO.jl

Reading and writing of video files in Julia via ffmpeg
https://juliaio.github.io/VideoIO.jl/stable
Other
128 stars 53 forks source link

GC'ing a VideoWriter without closing it first #404

Closed Octogonapus closed 1 year ago

Octogonapus commented 1 year ago

We are using VideoIO on a resource-constrained system and sometimes need to abort writing out a video. Running close_video_out! takes a long time in this case, presumably because it's writing out a bunch of frames to disk. Is it okay to skip this call and let the VideoWriter get garbage collected? Will all native resources still be freed? I ask because I noticed the implementation does some cleanup on the writer: https://github.com/JuliaIO/VideoIO.jl/blob/a445dfcc999488111502649250b3dd9fe5f06914/src/encoding.jl#L114-L119

galenlynch commented 1 year ago

I think the finalizers will still run if the writer itself gets GC’d before it’s closed, but it might be worth testing. The code there is just cleaning up the resources allocated by the writer by removing the writer’s references to them.

On Tue, Sep 5, 2023, at 11:20, :) wrote:

We are using VideoIO on a resource-constrained system and sometimes need to abort writing out a video. Running close_video_out! takes a long time in this case, presumably because it's writing out a bunch of frames to disk. Is it okay to skip this call and let the VideoWriter get garbage collected? Will all native resources still be freed? I ask because I noticed the implementation does some cleanup on the writer: https://github.com/JuliaIO/VideoIO.jl/blob/a445dfcc999488111502649250b3dd9fe5f06914/src/encoding.jl#L114-L119

— Reply to this email directly, view it on GitHub https://github.com/JuliaIO/VideoIO.jl/issues/404, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUDZT3XZTVUCJWYEBS54R3XY5UPXANCNFSM6AAAAAA4MFQ27M. You are receiving this because you are subscribed to this thread.Message ID: @.***>