BartoszCichecki / LenovoLegionToolkit

Lightweight Lenovo Vantage and Hotkeys replacement for Lenovo Legion laptops.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Potential Memory Leak

Pretentiousness opened this issue · comments

Rules

  • I made myself familiar with the README.
  • I checked closed issues for similar ones and did not find a similar problem mentioned before.
  • I understand that, if insufficient information was provided, my issue will be closed without an answer.

Version

2.20.2

OS

Windows 11 22h2

Device

Legion 7 16ITHg6

BIOS version

H1CN52WW

What's wrong?

legion tool kit constantly takes more and more ram till it reaches 2.1GB and then suddenly goes back to few 100 MB this cycle repeats forever.

After restarting the app, it doesn't go to 2.1GB anymore but it still cycles between 200-800MB range instead.

Screenshot 2024-03-27 171715

How to reproduce the bug?

Have Legion Tool Kit run in BG.

What is the behavior that you expected?

RAM usage to not cycle like this.

Logs

log_2024_03_27_11_54_46.txt

log_2024_03_27_21_25_16.txt

Additional information

I have multiple actions defined that are invoked every day.

Just FYI: It seems that the log you caught and uploaded isn't the correct one.

The following log msgs are found:

[27-03-2024 11:54:46.428] [1] [App.xaml.cs#289:EnsureSingleInstance] Checking for other instances...
[27-03-2024 11:54:46.429] [1] [App.xaml.cs#297:EnsureSingleInstance] Another instance running, closing...

I'm not sure if you've closed LLT before starting catching logs, but the log you uploaded doesn't report anything. You may have a look in your log directory and see if you can find the correct one, or you may recatch the log.

Just FYI: It seems that the log you caught and uploaded isn't the correct one.

The following log msgs are found:

[27-03-2024 11:54:46.428] [1] [App.xaml.cs#289:EnsureSingleInstance] Checking for other instances...
[27-03-2024 11:54:46.429] [1] [App.xaml.cs#297:EnsureSingleInstance] Another instance running, closing...

I'm not sure if you've closed LLT before starting catching logs, but the log you uploaded doesn't report anything. You may have a look in your log directory and see if you can find the correct one, or you may recatch the log.

log_2024_03_27_21_25_16.txt

updated log
also updated the original post

@Pretentiousness the only thing that I can see in the log, which might be weird, is that there is a process called PoC that runs very frequently (143 times to be exact withing 2 minutes). LLT monitors all processes in your case, since you have an Action defined that runs when some process is started.

I am not sure, which app starts so many processes, but I made some optimizations, but I am not sure how much it will help.

This isn't a memory leak though - what you see is just high memory usage, which periodically is cleaned up by .NET. I think it might be caused by a large number of processes, one of the apps is starting on your machine (297 processes started according to your log over 2 minutes).

You can try a build that is optimized, but I am not sure if this issue will be completely resolved: installer. Important: this installer already requires .NET 8, so if it isn't installed already on your machine, this setup should install it automatically.

If that doesn't resolve all issues, there are two options:

  1. figure out which app is responsible for so many processes, and ask the author to optimize it
  2. do not use "When process started/stopped" action

I don't see another way around it, since it seems like we are hitting some .NET limitations in handling processes.

@Pretentiousness the only thing that I can see in the log, which might be weird, is that there is a process called PoC that runs very frequently (143 times to be exact withing 2 minutes). LLT monitors all processes in your case, since you have an Action defined that runs when some process is started.

I have found which process that is. Its Legion Fan Control haha. i think you should hard code an exception for it of some kind.... if possible so that Toolkit doesnt listen to it. ofc it will run frequently to change fan. but by looking at frequency i think i need to further optimise the idle settings of fan curve

But did you check the build that I linked?

But did you check the build that I linked?

I will attach logs for that version later tonight to this same post i am out atm

here are the logs
log_2024_03_29_17_46_45.txt

@BartoszCichecki the issue is not resolved on latest version. i think you should just make an exception for Legion Fan Control app