<html><head><style>pre,code,address {
margin: 0px;
}
h1,h2,h3,h4,h5,h6 {
margin-top: 0.2em;
margin-bottom: 0.2em;
}
ol,ul {
margin-top: 0em;
margin-bottom: 0em;
}
blockquote {
margin-top: 0em;
margin-bottom: 0em;
}
</style><style>pre,code,address {
margin: 0px;
}
h1,h2,h3,h4,h5,h6 {
margin-top: 0.2em;
margin-bottom: 0.2em;
}
ol,ul {
margin-top: 0em;
margin-bottom: 0em;
}
blockquote {
margin-top: 0em;
margin-bottom: 0em;
}
</style></head><body><div>On Fri, 2023-09-15 at 10:23 -0400, Nicolas Dufresne via gstreamer-devel wrote:</div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div id=""><div class="js-helper js-readmsg-msg"><div><div id="style_16947347981376795412_BODY"><div class="mail-quote-collapse"><br>> Appsink config and NewSample handler is below. My problem is that it consumes lot’s of (unmanaged) memory.<br>> There is no leak, it works ok, after .net GC run memory lower to normal values and then grows again. It looks like<br>> saw-tooth. I’ve tried to limit max-buffers (set it to 100 or 1), drop = true but it seems that nothing works. Memory profiler shows smth like 30K instances of Gst.Memory holds 1.5Gb of unmanaged (in terms of .net) memory. Aftre GC collect, it seems to collect some of these instances and release some unmanaged memory (say it lowers 10 times). Again, there is no leeks, I just want to lower memory consumption of appsink element.</div></div></div></div></div></blockquote></blockquote><div><br></div><div>I believe recent C# GC allow you to do explicit unref (nullifying the object) to workaround the issue. The GC have no idea about the size of the object/buffer, so it does not prioritize it.</div></blockquote><div><br></div><div>Also the bindings allow you to call dispose() on the object to "invalidate" it (any further calls on it will cause an exception then). That also unrefs the native object immediately.</div><div><br></div><div>The problem you're running into here is the main problem with any bindings for a language with a tracing GC, unfortunately. Or at least the cases where you can't provide more information (and object traversal information) to the GC.</div><div><br></div><div><span><pre>-- <br></pre><div><div><span style="font-family: Calibri, sans-serif; font-size: 14.666667px;">Sebastian Dröge, Centricular Ltd · </span><a href="https://www.centricular.com/" title="Click to open https://www.centricular.com/" style="color: rgb(0, 0, 238); font-family: Calibri, sans-serif; font-size: 14.666667px;">https://www.centricular.com</a></div></div></span></div></body></html>