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

Large memory footprint - option to NOT stay resident? #33

Closed
TheDannemand opened this issue Nov 1, 2024 · 20 comments
Closed

Large memory footprint - option to NOT stay resident? #33

TheDannemand opened this issue Nov 1, 2024 · 20 comments

Comments

@TheDannemand
Copy link

TheDannemand commented Nov 1, 2024

Thank you very much for this useful toolkit.

Up until now, I'd been using Lenovo Legion Toolkit with my Yoga 7 16IRL8. That toolkit has a ton of features, including some very elegant ones, but most of which do not work on my Yoga anyway -- and the features I REALLY need are not compatible with my Yoga.

IdeapadToolkit has JUST those features I need the most, which are to control Power Profile and Battery Charging Mode.

As far as I can tell, it is fully compatible with my Yoga. So again, thank you very much!

One concern I have is memory footprint: IdeapadToolkit stays resident when you close it and consumes a whopping 190MB. I am guessing we have .NET to thank for that.

I need every MB on my 16GB laptop, and while I appreciate the convenience of the Tray icon, I don't need it at all.

Would it be possibly to make staying resident on close an option (similar to Run On Startup)?

Thank you in advance.

@reagcz
Copy link
Owner

reagcz commented Nov 1, 2024

Hi, are you sure it's consuming 190MB? Mine consumes just 40MB when running in the taskbar. Are you sure you're looking at the active private working set?

@reagcz
Copy link
Owner

reagcz commented Nov 1, 2024

I've added it in the new release. Still, I'd love to see a memory dump of the app running on your system, to see if there's any deeper problems.

@TheDannemand
Copy link
Author

TheDannemand commented Nov 1, 2024

I cannot believe how quickly you responded and acted. That's amazing!

I should have included TaskManager screendumps in the first place. See attached: One is with the app Open, the other with it in the Tray. Sometimes I see it dropping to ~120MB.

IdeapadToolkit 1 3 1 - Open - TaskManager - 2024-11-01

IdeapadToolkit 1 3 1 - Tray - TaskManager - 2024-11-01

The new version 1.3.2 works like a charm. Same memory footprint, but not a problem for me, as I close it right away.

Please let me know if there is anything else I can provide to help you diagnose the memory situation.

Thank you, again, for this excellent tool and for your fast response!

@reagcz
Copy link
Owner

reagcz commented Nov 1, 2024

No problem. If you have the time, please upload a memory dump somewhere so I can take a look. There might be a memory leak. However, no one else reported anything like this, so I'll close the issue now.

@reagcz reagcz closed this as completed Nov 1, 2024
@reagcz
Copy link
Owner

reagcz commented Nov 1, 2024

I could perhaps reduce the memory by switching back to .net framework, or winui 3 with nativeaot, but both would be quite a drag

@TheDannemand
Copy link
Author

I wouldn't sweat it if I am the only one reporting the high footprint. But naturally I am happy to provide anything you need. What kind of memory dump, and how do I create it?

@reagcz
Copy link
Owner

reagcz commented Nov 1, 2024

There's two options.

  1. in task manager, you right click a process, and there's a create memory dump button.
  2. using the dotnet-dump tool, which you would have to install.

I assume both dumps will be quite large, so no problem if you don't have any means to upload them.

@TheDannemand
Copy link
Author

Of course, duh. I just never used that memory dump feature in Task Manager before.

It is uploading to my Google Drive now. I have to attend a meeting and will send you the link in about an hour. Can I share this just with you, not publicly?

@reagcz
Copy link
Owner

reagcz commented Nov 1, 2024 via email

@TheDannemand
Copy link
Author

I replied by email with link to the memory dump. I then deleted that comment in here after an hour. The email with the link should still be in your Inbox. Otherwise let me know, and I'll share again.

I really am very grateful for your work. If there is anything else I can do, let me know.

@reagcz
Copy link
Owner

reagcz commented Nov 1, 2024 via email

@reagcz
Copy link
Owner

reagcz commented Nov 1, 2024 via email

@TheDannemand
Copy link
Author

Excellent!

Just let me know if you need anything else. Again, I am very grateful for your work!

@reagcz
Copy link
Owner

reagcz commented Nov 3, 2024

If you're interested, I've analyzed the dump and found no evidence of a memory leak.
The managed heap takes about 20MB and 30 is used by the unmanaged heap. The rest is taken by all the .NET dlls.
If the main window is closed and the program is running in the background, most of this memory can get paged to the disk and the active working set goes as low as single digit MBs, so I don't consider the memory usage an issue for now.

@TheDannemand
Copy link
Author

TheDannemand commented Nov 3, 2024

Thank you, Filip. I am definitely interested and appreciate your report.

Glad to hear memory leaks weren't to blame. So .NET was indeed the culprit, as expected. Still puzzling why it consumes so much more memory on my laptop, but I guess that's the thing with .NET.

I understand what you are saying that most of that memory would likely be paged. Knowing that, I may occasionally leave IdeapadToolkit running in the Tray. But I have it on a HotKey already, so opening it is already as fast and convenient as locating with the mouse in the Tray, particularly since I keep my Windows TaskBar hidden.

If you are interested in feature ideas for future development (and ONLY if you are) I can suggest a few inspired by Lenovo Legion Toolkit (LLT).

  • Showing battery charge/discharge rate, capacity, charge cycles and other battery info (LLT Battery tab).

  • Disabling/enabling Vantage (LLT Settings tab: toggles tasks in Task Scheduler Library/Lenovo/Vantage and Task Scheduler Library/Lenovo/UDC, require manual restart after disabling). This allows leaving Vantage installed but disabled, so that one can load it occasionally to install driver updates.

  • The requirement to install .NET 8 is one that almost kept me from trying IdeadpadToolkit in the first place. I imagine some others may feel the same.

But seriously, ONLY listen to these if you are interested and looking to expand the software. As it is now, IdeapadToolkit is almost perfect for my use.

Thank you once again for your great work!

@reagcz
Copy link
Owner

reagcz commented Nov 3, 2024

Thanks for the ideas. I'll look into them if I have some free time in the future. The .NET 8 runtime... I have four options
a) Switch back to .NET Framework, which is shipped with Windows.
b) Ship the app with an installer, that would install .NET for you, but that felt pretty overkill for such a small app.
c) Publish the app as self-contained, which would pack the runtime with the app, but that increases the exe size to almost 200MB
d) Try publishing it in the Microsoft store, but I'm not sure how Lenovo would feel about that

@TheDannemand
Copy link
Author

Thank you for explaining. I can definitely understand why you chose what you did, given that it is such a small app.

I think the most appealing of those options from a user standpoint would be (a) since almost everybody has .NET installed with Windows nowadays. It's not like the old days when installing .NET was an extra installation. However .NET 8, however, IS an extra install.

That's just my opinion. Again, I love IdeapadToolkit the way it is already.

@reagcz
Copy link
Owner

reagcz commented Nov 5, 2024

As a bit of an experiment, I've ported the app to Windows App Sdk and it is now compiled ahead of time. There is no dependency on the .NET runtime now, so no need to install anything. Hopefully, the memory consumption of this version is a bit better. Note that it's still a bit buggy.

@TheDannemand
Copy link
Author

Boy, you are unstoppable, Filip!

I just checked now, and see the experimental release, but no binary download yet. I'll test this whenever you feel it is ready for testing. Just say the word.

@TheDannemand
Copy link
Author

I am sorry to re-open this issue, but I just want to mention that Ideapad Toolkit has worked flawlessly on my Yoga 7 16IRL8 since our exchange in early November. I'd say you can safely add Yoga 7 (possibly other Yogas too) to the list of supported models.

Thanks again for this excellent tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants