-
Notifications
You must be signed in to change notification settings - Fork 194
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
ClrMD memory leak Thread.BlockingObjects #19
Comments
I suspect it might have to do with finalization -- can you add |
That explanation sounds wrong, he's using a loop so "not getting reclaimed at the first GC" makes no sense. There should be plenty of time for the finalizer thread to clean up stuff (unless he's producing it faster than it can be cleaned up). Anyways, I've run his sample code he posted above and on VS 2015 / .NET 4.6 this does not leak any memory. [update] Wasn't running it long enough here, the leak isn't large and the example may need to run a few minutes before the leak becomes noticeable. |
What version of ClrMD are you using? I have tried it in .Net 4.6 as soon as Sasha posted his comment and got "This runtime is not initialized and contains no data." exception Microsoft.Diagnostics.Runtime.RuntimeBase..ctor(DataTargetImpl dataTarget, DacLibrary lib) ClrVersions collection of DataTarget objects contains only 1 item 4.6.81.00 |
@Darkwalker that's a known issue (#11) with .NET 4.6, it looks for a 4.0 runtime instead of the 4.5+ runtime - see PR #23 for a fix (it's a one liner to fix the version check which has been known for a while but unfortunately nobody is updating the repository or the nuget package) |
Patched dll does not throw exception, but it still leaks about 1 MB per minute, even after addition of
|
Hm, ok I think I can see it now too, wasn't running it long enough previously. Seems to leak less for me than for you though. I also see peaks in memory and across those peaks the leaks are a bit larger (might be the same as the spikes in your graph, but then you have a different resolution than me). I'll take a closer look on it later or maybe next week, as time permits, maybe I can figure something out. |
@Darkwalker Trying to debug this I'm seeing wildly different results on different OS and CLR versions. More importantly, I'm seeing different results between analyzing a dump file and attaching to a live process. Can you confirm your OS and CLR versions? |
@Darkwalker Can you please confirm that when removing the |
I am running on Windows 8.1 (6.3.9600) and .Net 4.6.81.00 |
@Darkwalker Well, here's one leak I found (I am sure there are more because this one is only responsible for about 10% of the leaking heap memory I can see). This specific condition occurs when running your sample, i.e. when the process "attaches" to itself and tries to obtain the blocking objects for each thread. Getting the thread's The failure in Yesterday I was also able to reproduce this bug when attaching to another process (not the same process), so I will try looking into that as well. |
Found some more tiny leaks like that. For example, calling I have to conclude that it seems there was no serious stress-testing performed of the DAC interfaces (CLRMD is probably not at fault here), and we're looking at the results of that... |
Nice work. Are the coreclr guys aware of this? If not it might make sense to create an issue there, too. |
We've moved CLR MD into its own GitHub repository. If this issue still applies, please file it there. Sorry for the inconvenience but we never intended for this repo to contain the component itself. |
The code:
When you run this code managed memory stays consitent, but native memory grows consistently. The detalization of most memory allocations below:
In my test run I got from 2.2 MB to 10.5 MB in 8 minutes, so I guess it is easily reproducible.
The text was updated successfully, but these errors were encountered: