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

NetDriver leaks Task+DelayPromiseWithCancellation etc... objects #2889

Closed
tig opened this issue Oct 6, 2023 · 0 comments
Closed

NetDriver leaks Task+DelayPromiseWithCancellation etc... objects #2889

tig opened this issue Oct 6, 2023 · 0 comments
Assignees
Labels
bug v2 For discussions, issues, etc... relavant for v2

Comments

@tig
Copy link
Collaborator

tig commented Oct 6, 2023

@BDisp,

I fixed the most egregious memory leak in Netdriver here.

However, the interplay between the threading Tasks in NetMainLoop and NetEvents is horrifically complex and I'm not sure I got it right. I'd really appreciate a thorough code review by you.

In addition, there still is a very weird memory leak (or allocation of objects that doesn't make sense):

  1. Set "Application.UseSystemConsole": true in ./UICatalog/bin/Debug/net7.0/.tui/UICatalog.config
{
    "Application.UseSystemConsole" : true
} 
  1. Start Performance Profiler with memory profiling on
  2. Take a snapshot right away
  3. Double click on "Generic"
  4. Hit ESC to close Generic
  5. Take a snapshot

You'll see something like this:
image

Click on the +1612 and see this (sort by "Count Diff"):
image

For some reason ~1000 "Task+DelayPromiseWithCancellation" objects are being created. The number is different each run, but not in an deterministic way. I've also noticed that it has something do with mouse vs. keyboard input. But I've not been able to find a pattern. Nor have I figured out how to fix it (obviously).

Maybe you can see what's going on?

Originally posted by @tig in #2885 (comment)

@tig tig added the v2 For discussions, issues, etc... relavant for v2 label Oct 6, 2023
@tig tig assigned tig and BDisp and unassigned tig Oct 6, 2023
@tig tig added the bug label Oct 6, 2023
BDisp added a commit to BDisp/Terminal.Gui that referenced this issue Oct 15, 2023
@tig tig closed this as completed Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug v2 For discussions, issues, etc... relavant for v2
Projects
No open projects
Status: ✅ Done
Development

No branches or pull requests

2 participants