-
Notifications
You must be signed in to change notification settings - Fork 731
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
High memory usage #701
Comments
Can you reproduce this behaviour with an unmodified example, if so which one? I really have nothing to go on here. |
I've fired up the webcam example and Yes, I'm getting the same behaviour. Memory usage linearly goes up until the track ends or I stop the streaming manually - then the usage instantly drops back down. |
Ok, so let's focus on the webcam example if that one triggers the issue reproducibly. Are you running the latest version of PyAV as a memory leak was fixed in 9.2.0? |
I've been using 9.1.0 when I noticed the issue. I've just updated it to 9.2.0, tested again and the issue still occurs. |
Any updates on this? I would really like to continue using this library but this issue is slowing down the development of my project. I'm really open for collaboration. Is there any other info I can provide? I would be more than happy if I could help resolve this problem. |
No updates to report here, this is not a free help hotline! Profiler traces showing where the memory allocation is happening would help. Also a fairly obvious question: is video playback falling behind? If so that would indicate you are not able to encode the video in real-time, and I would indeed expect memory usage to grow as the the backlog builds up. |
I have met the same problem when i run the webcam example on raspberry 4B(ram 4G), |
My memory issues from #680 have not gone away entirely either. After a day or two of streaming audio, I get to the max memory for my VM (8 GB) and my script crashes. Interestingly none of the memory traces I've ran have shown the memory being consumed. The standard |
Thanks for this, it's definitely narrowing down the scope. What puzzles me is that the code generating seems related to an output container, meaning we're writing a media file. Unless I'm mistaken the only place this occurs would be if @W3AXL what example are you running? |
This is part of a larger project I'm working on, but the WebRTC functionality is relatively straightforward. Basically, I'm just doing bidirectional audio between a javascript client and the python server. Single audio track in each direction, nothing more. The entirety of the aiortc code in my project is located on these lines: https://github.com/W3AXL/python-radio-console/blob/version-2/radio-daemon.py#L391-L535. I'm not doing anything super funny or out of the ordinary as far as I can tell. |
@W3AXL can you try replacing MediaRecorder with MediaBlackhole please and re-running your measurement? |
Replaced the one instance of
|
I'm confused here: are you actually talking about the same issue as the original poster? Is it just "aiortc/pyav uses memory", or "aiortc/pyav has a runaway memory usage which is continuously increasing"? |
It's the same issue - with |
OK so it sounds as though there is something wonky in PyAV's memory ownership model for packets.. We probably need a much simpler test case which just runs packets through PyAV, I don't think aiortc's the source of the problem. |
I'd agree with you, it looks like the I could go ahead and open an issue over there, but since Your responses and willingness to help me with this issue are greatly appreciated! |
Just for kicks, I upgraded my PyAV version to 10.0.0 to see if the issue still exists. |
I had the same problem when I tried to pass the |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@enard-dbzr We have a similar problem. Did you find a solution to this issue? |
My application is crashing due to high memory usage. It appears to be due to MediaPlayer After some investigation, this simple code demonstrates the problem. Memory usage increases with time despite playing the same file over and over.
|
Version aiortc 1.8.0
Afterwards, there will be a surge in memory usage |
If you never close the tracks, the media player's memory is not released. player.audio.stop()
player.video.stop() |
Hi, I've noticed some very high memory usage by this library, possibly a memory leak.
Whenever I stream anything to my receiver peer, my RAM usage linearly goes up until it overflows and my PC slows down to the point of having to reboot. The rate at which the usage increases seems to depend on the input file I decide to stream. I've also noticed that (strangely enough) the memory usage seems higher when sending only audio and no video.
I have also tried to add an event listener for receiving remote tracks, in case I need to discard them using the
MediaBlackhole
, but it never gets called, so no tracks to handle.Codecs:
opus
&H264
I don't know what other data might be relevant for troubleshooting this issue, so please comment in case I should send anything.
Thanks in advance
The text was updated successfully, but these errors were encountered: