Comments (6)
This is because av.audio.resampler.AudioResampler
uses av.filter.graph.Graph
, and obviously graphs require a circular reference which would create an object that is not deletable by traversing acyclic reference graphs. Because of it, while the AudioResampler
gets deallocated when it gets out of scope, Graph
does not.
It is not a bug, because it does not affect the program's correctness, and the author has relied on cpython's implementation of the cyclic garbage collector to clean up the resources. It would be a performance enhancement if the reference loop is eliminated.
from pyav.
@MahmoudAshraf97, please test again using 851ff21. It will not solve the issue completely, but it could reduce some of the memory footprint.
from pyav.
I guess the problem still exists, and since repeating the same experiment many times doesn't guarantee exact reproduction, I cant verify whether this is partially solved or not
from pyav.
Using large enough iteration will help to make the result somewhat deterministic.
In my machine (arm64 M2 Pro Darwin 14.4.1), with delete=False, collect=False, n=200
;
Without applying the patch (left) I can see the gc periodically cleans the circular referenced objects and there seems to be some objects that cannot be recovered by gc.
After applying the patch (right) the memory graph is steadily increasing and no signs of visible gc activity. The graph could indicate a real leak though I haven't investigated it further. Overall the memory footprint seems to be significantly smaller.
@MahmoudAshraf97, can you try my patch again with delete=False, collect=False, n=200
and compare it with v12.1.0 or main?
from pyav.
@moonsikpark The Graph
object probably has a memory leak, and it certainly has it's own circular references.
from pyav.
Related Issues (20)
- Functional Difference In Data Stream between AV 11.0.0 and AV 12.0.0 HOT 1
- AV 12.0.0 decoded frames do not match source as in AV 11.0.0 (potential colorspace issue) HOT 3
- Missing shared object file after upgrading to Python 3.12 HOT 1
- frame.index is deprecated HOT 1
- Provide Apple M1 binaries for pypy HOT 2
- Compatibility with NumPy 2.0? HOT 9
- to_bytes does not exist on Packet. HOT 2
- Generating a video with numpy and writing it with pyav does not preserve color HOT 1
- Unable to set frame rate HOT 3
- `argument 2 of βav_bsf_list_parse_strβ from incompatible pointer type` in `bitstream.c` HOT 8
- Expose `av_frame_make_writable` HOT 2
- Support for v360 video filter HOT 1
- How do I set the value of slices?
- Allow using the ffmpeg cli API HOT 2
- Help in remuxing without decoding HOT 1
- av/frame.pxd:1:8: 'libav.pxd' not found HOT 1
- Decoding full-range yuv444p to RGB differs from ffmpeg HOT 1
- Decoding full-range yuv444p to RGB differs from ffmpeg HOT 2
- `AudioLayout` constructor with an `AudioLayout` instance is broken
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyav.