Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GC'ing a VideoWriter without closing it first #404

Closed
Octogonapus opened this issue Sep 5, 2023 · 1 comment
Closed

GC'ing a VideoWriter without closing it first #404

Octogonapus opened this issue Sep 5, 2023 · 1 comment

Comments

@Octogonapus
Copy link
Contributor

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:

VideoIO.jl/src/encoding.jl

Lines 114 to 119 in a445dfc

# Free allocated memory through finalizers
writer.format_context = AVFormatContextPtr(C_NULL)
writer.codec_context = AVCodecContextPtr(C_NULL)
writer.frame_graph = null_graph(writer.frame_graph)
writer.packet = AVPacketPtr(C_NULL)
writer.stream_index0 = -1

@galenlynch
Copy link
Collaborator

galenlynch commented Sep 6, 2023 via email

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

No branches or pull requests

2 participants