AhkThread and memory usage Topic is solved

Ask for help, how to use AHK_H, etc.
murataygun
Posts: 104
Joined: 07 Aug 2015, 15:53

AhkThread and memory usage

Post by murataygun » 29 Nov 2021, 07:46

- I made a small script to log some stats to webdatabase.
- My main script runs this thread with some command arguments.

Code: Select all

AhkThread(postEvent, """Win + Q"" ""Test"" """" " SubStr(VERSION, -9) " " ISAKTIF " ""stat türü""")
(This logging activity will be used very often)

Everytime i use AhkThread my scripts memory usage increases about 1MB. One hour later it ends up hundreds of MBs.
My question is;
How can i manage this usage. Basicly i just want my small script/thread to [ Run - Do work - Die ] And left nothing behind. And may be a situation that this thread may run -allmost- concurrently. One after an other with different parameters.

Thank you.

murataygun
Posts: 104
Joined: 07 Aug 2015, 15:53

Re: AhkThread and memory usage  Topic is solved

Post by murataygun » 29 Nov 2021, 12:19

I guess DynaRun instead of AhkThread did the jop.

HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: AhkThread and memory usage

Post by HotKeyIt » 29 Nov 2021, 21:28

You need to release/free the object used for the thread, see AhkThread.

murataygun
Posts: 104
Joined: 07 Aug 2015, 15:53

Re: AhkThread and memory usage

Post by murataygun » 30 Nov 2021, 06:54

HotKeyIt wrote:
29 Nov 2021, 21:28
You need to release/free the object used for the thread, see AhkThread.
Yes. As i asked before; how am i gonna manage it? Thread works with newtwork. It may last 1 second or 20 seconds. How do i know when to terminate that thread. If i wait thread to finish its jop its nonsense to use Multi threading. Should i write my own garbage collection?

One more thing. Is my DynaRun implementation correct? Well it works but couldn't test really.

HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: AhkThread and memory usage

Post by HotKeyIt » 30 Nov 2021, 21:47

DynaRun should work fine, if you don't need to communicate to the threads.
I usually reuse my threads when they are not running anymore.

Post Reply

Return to “Ask for Help”