Skip to content
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

ClrThread.StackTrace memory leak #47

Closed
stjeong opened this Issue Aug 19, 2016 · 3 comments

Comments

Projects
None yet
3 participants
@stjeong
Copy link

stjeong commented Aug 19, 2016

To repro, I just write a program like this,

while (true)
            {
                using (DataTarget target = DataTarget.AttachToProcess(
                                                            Process.GetCurrentProcess().Id, 5000, AttachFlag.Passive))
                {
                    ClrRuntime runtime = target.ClrVersions.First().CreateRuntime();
                    foreach (ClrThread thread in runtime.Threads)
                    {
                        IList<ClrStackFrame> stackFrames = thread.StackTrace;
                    }
                    runtime.Flush();
                }
            }`

about 50MB leaks per every seconds.

@Zero3

This comment has been minimized.

Copy link

Zero3 commented Mar 23, 2017

I'm also seeing a memory leak doing almost exactly what you posted :/.

@leculver leculver closed this Nov 19, 2018

@leculver leculver reopened this Nov 19, 2018

@leculver

This comment has been minimized.

Copy link
Contributor

leculver commented Nov 19, 2018

I found the issue, unfortunately it's difficult to work around. The underlying problem is that this if block is missing on Desktop CLR:

https://github.com/dotnet/coreclr/blob/75890669d59ea8e1a28ade8222ebec2706082674/src/debug/daccess/task.cpp#L370

I will file an internal bug about this and try to get it fixed in Desktop CLR. Unfortunately I don't plan to do some crazy workaround for this in ClrMD unless there's no fix for it in CLR 4.8.

@leculver leculver closed this Nov 19, 2018

@leculver

This comment has been minimized.

Copy link
Contributor

leculver commented Nov 19, 2018

Actually I've found a really ugly workaround and submitted it as acd7268. This will be fixed in ClrMD 1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.