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

Frame is leaking memory #117

Open
chpio opened this issue Sep 16, 2018 · 4 comments
Open

Frame is leaking memory #117

chpio opened this issue Sep 16, 2018 · 4 comments

Comments

@chpio
Copy link

chpio commented Sep 16, 2018

examples/transcode-audio.rs is leaking memory. Im encoding music files in batches (transcoding one directory structure and all music files in that directory into an other directory). I was using rayon for concurrent transcoding and i could see ~100mb/s memory increase in htop. The memory usage never went down.

I workarounded/fixed that by calling av_frame_unref on the frame in the encode-loop: https://github.com/chpio/audio_conv/blob/d9b9ce739703282e92114ec58bfc3b5b0b8fe590/src/main.rs#L200

But that shouldn't be required as

  1. ffmpeg should reuse the allocated memory in the frame (i would assume that as a user)
  2. the frame shouldn't leak memory because it gets destroyed at the end of the encoding process
@chpio chpio changed the title Memory leaks Frame is leaking memory Sep 16, 2018
@barzamin
Copy link
Collaborator

barzamin commented Sep 21, 2018

huh, that's weird that it's leaking memory given that av_frame_free() is called on drop

i'll have to look into this

@chpio
Copy link
Author

chpio commented Feb 25, 2019

@barzamin yep, that's what i meant (or assumend) by my 2. point

@xd009642
Copy link
Contributor

I've experienced this same issue although I was using https://github.com/zmwangx/rust-ffmpeg

@chpio
Copy link
Author

chpio commented Apr 30, 2021

@xd009642 It seems that (all?) rust ffmpeg bindings are not very optimal, break on different ffmpeg versions etc. I switched to gstreamer when a particular rust version (1.40 or something) refused to compile the ffmpeg bindings.

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

3 participants