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

I appreciate the effort y'all have put into developing this application. Unfortunately there's a lot of things that could be improved. #2

Open
luke-beep opened this issue Oct 12, 2023 · 2 comments

Comments

@luke-beep
Copy link

luke-beep commented Oct 12, 2023

I appreciate the effort y'all have put into developing this application. Unfortunately there's a lot of things that could be improved.

The calls to GC.Collect() and GC.WaitForPendingFinalizers() will not affect the external processes you're trying to limit. These calls only impact the .NET application running this code.

The application could be more efficient in its use of CPU cycles and memory, especially considering the frequent calls to certain methods.

The routines are sub-optimal (eg. You have several routines with the same purpose), I'd recommend giving this system a complete refactoring if anything and stop calling GC.Collect() and GC.WaitForPendingFinalizers(), it's not recommended to do so (https://learn.microsoft.com/en-us/dotnet/api/system.gc.collect?view=net-7.0).

Very poor memory management; eg. Process objects and ManagementObjectSearcher should be disposed, but they aren't.

This application lacks in exception handling as well, make sure to catch and handle errors that might occur; such as SetProcessWorkingSetSize and WMI queries.

Here are some solutions that y'all could take a look at -> https://github.com/luke-beep/MMF/blob/master/Program.cs.

@0vm
Copy link
Owner

0vm commented Oct 14, 2023

I appreciate it, giving it an attempt!

@luke-beep
Copy link
Author

I appreciate it, giving it an attempt!

Good luck 🍀

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