Uh oh!
There was an error while loading. Please reload this page.
Allow IL scanner's dependency graph be GC'd - #72430
Conversation
We don't need to keep the graph in the memory once we're done scanning. Verified it gets collected now by adding a finalizer to `ILScanNodeFactory` and having it print something. It didn't get collected previously. If I'm measuring it right, it was rooting about 17 MB of objects in memory on a hello world.
VSadov
commented
Jul 19, 2022
I like the improvement, but I wonder if there is something wrong with the liveness analysis and thus the user needs to do this. Is it the part that the containing method is 500-lines long that makes it difficult to track when the scanner is unreachable? |
MichalStrehovsky
commented
Jul 19, 2022
I didn't test whether just shuffling things around (without moving scanning into a separate method frame) would be sufficient to get it GC'd. It might have been enough. JIT is free to extend the lifetimes of things however it sees fit - an extra method frame makes sure the locals really become dead no matter what the JIT decides to do now or in the future. |
We don't need to keep the graph in the memory once we're done scanning.
Verified it gets collected now by adding a finalizer to
ILScanNodeFactoryand having it print something. It didn't get collected previously. If I'm measuring it right, it was rooting about 17 MB of objects in memory on a hello world.Cc @dotnet/ilc-contrib