Does Python GC deal with reference-cycles like this?

Python’s standard reference counting mechanism cannot free cycles, so the structure in your example would leak. The supplemental garbage collection facility, however, is enabled by default and should be able to free that structure, if none of its components are reachable from the outside anymore and they do not have __del__() methods. If they do, … Read more

Channels with CancellationTokenSource with timeout memory leak after dispose

I was able to reproduce the issue you are observing. It is clearly a flaw in the Channels library IMHO. Here is my repro: using System; using System.Diagnostics; using System.Threading; using System.Threading.Channels; using System.Threading.Tasks; using System.Threading.Tasks.Dataflow; public static class Program { public static async Task Main() { var channel = Channel.CreateUnbounded<int>(); var bufferBlock = new … Read more

Opening XPS document in .Net causes a memory leak

Well, I found it. It IS a bug in the framework and to work around it you add a call to UpdateLayout. Using statement can be changed to the following to provide a fix; Using XPSItem As New Windows.Xps.Packaging.XpsDocument(PathToTestXps, System.IO.FileAccess.Read) Dim FixedDocSequence As Windows.Documents.FixedDocumentSequence Dim DocPager As Windows.Documents.DocumentPaginator FixedDocSequence = XPSItem.GetFixedDocumentSequence DocPager = FixedDocSequence.DocumentPaginator DocPager.ComputePageCount() … Read more