Page 1 of 1

AutoHotkey.dll (AhkDllThread)  Topic is solved

Posted: 14 Sep 2017, 06:55
by lsh

Code: Select all

loop,10000
{
AhkDllRank% A_index%: = AhkDllThread(%ScriptDir%\autohotkey_H_unicode_32.dll)
ScriptPath: = A_ScriptDir. "\ ". A_index. ". ahk "
SFile: = FileOpen (ScriptPath, "r ")
SText: = SFile.Read ()
SFile.Close ()
AhkDllRank% A_index% .AhkTextDll(SText)
}
If you run this script repeatedly, you will get 262 indexes (1 SFile -> 100KB)

[Error Continuable exception_access_violation
Mouse and Keyboard hooks have benn disabled.
-Press Yes to exit thread and continue execution
-Press no to continue thread (debug).
-Press cancel to exit application
exception was caused in thread id : 8004]

Error.

My guess is that there is a maximum limit for multithreading in A's,

Is there a way to perform 1000 indexes ... and even 10000 indexes without difficulty :?:
edit: duplicate post removed

Re: AutoHotkey.dll (AhkDllThread)

Posted: 14 Sep 2017, 15:19
by HotKeyIt
There is a limit for the Stack StackReserveSize * Threads, see: https://github.com/HotKeyIt/ahkdll/blob ... xproj#L168
ExeThread in AHK_H v2 can handle a lot more threads, following stops for me at ~3500 threads:

Code: Select all

loop 10000
	e%A_Index%:=ExeThread("#Persistent"),ToolTip(A_Index)

Re: AutoHotkey.dll (AhkDllThread)

Posted: 07 Aug 2019, 09:07
by manehscripts
HotKeyIt wrote:
14 Sep 2017, 15:19
There is a limit for the Stack StackReserveSize * Threads, see: https://github.com/HotKeyIt/ahkdll/blob/master/AutoHotkey.vcxproj#L168
ExeThread in AHK_H v2 can handle a lot more threads, following stops for me at ~3500 threads:

Code: Select all

loop 10000
	e%A_Index%:=ExeThread("#Persistent"),ToolTip(A_Index)
Hi!

I'm having the same problem.
There is no way to prevent this error other than by migrating to AHK_H v2 ?

Re: AutoHotkey.dll (AhkDllThread)

Posted: 07 Aug 2019, 11:03
by swagfag
manehscripts wrote:
07 Aug 2019, 09:07
There is no way to prevent this error other than by migrating to AHK_H v2 ?
there is. dont spawn 10000 threads