The final question first: Is there a reason, that Autoit doesn't clean up RAM usage as a standard feature?
This posting by @guinness was pointing me to the solution for solving my problem:
DllCall("psapi.dll", "int", "EmptyWorkingSet", "long", -1) this simple, single line called on a regular basis stopped the script consuming more and more RAM.
This is my first post. So I’ve worked on a script for a while and I’m planning to publish it but the problem is that it connects to an FTP server at some point, and as you probably know FTP credentials are easily captured by a MITM attack or Wireshark (not sure if Wireshark does). So I thought if i can detect data capturing in the user’s network the script would stop. Any idea?.
If there’s another workaround I’m happy to hear it.
Here test example of a dummy program with random added controls to the main form:
If #include <GuiListView.au3> is commented out, then this simple program uses around 3,5 MB of RAM. When #include <GuiListView.au3> NOT commented out - RAM usage is around 13-14 MB.
How can I reduce memory usage? Even if I'm not using GuiListView.au3 - 3,5 MB quite a bit for a such dummy program!
I found out that using this DLLCall in main loop:
DllCall("psapi.dll", "int", "EmptyWorkingSet", "long", -1) Significantly reduces RAM usage (even with GuiListView.au3 included, from 13-14 MB to 600 KB !!! ) but I'm not sure if it's doesn't have any impact to common workflow of a program...
So, give me any advice about that, please.
The back story:
I've got a Dell XPS w/ i7-8700K. The fastest, by single core, I could get, by well known PC maker.
The problem is that the fan can get so loud, like, REALLY LOUD, I can not use the CPU at its max. clock speed.
I could leave it at 90% all the time and not use this but I want to have the full 4.x Ghz and no parked cores, at all times, if I can.
But as room temperature and CPU load changes, a set throttle, may still make fan noise.
To avoid the fan from going "airplane turbine mode", the utility gets the temp. from "Core Temp" ( you can google it )
It has a"plug-in" called "Core Temp Remote Server". The utility gets the values via TCP.
When it "feels" it's gonna get hot, drops the CPU throttle to a selected value, lets say 99% ( where is quieter ) and back up to 100% when it "feels" is ok to go back.
Now temperature can creep up to higher than expected if load is sustained or room temperature changes. So there is an "anti creep up" feature, to temporarily set the throttle even lower, 5% at a time, until the known quiet temperature is achieved.
If don't know how to find the temperature you should use, check out these videos. They will tell you how.
The end result:
Any thermal problem, is a hardware problem. No way around that, other than attending to the CPU cooling and case ventilation. Software can not fix that.
But without this utility, the PC would slow down the CPU anyway, to keep it from melting.
This software preemptively slow down the CPU, keeping the CPU related fan speeds from going to maximum RPM. Hence having a slower, but a quieter box.