Skip to content

Commit

Permalink
Add ReloadTCMatchInternal config
Browse files Browse the repository at this point in the history
  • Loading branch information
goreliu committed Apr 17, 2016
1 parent 545d127 commit 6471f70
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Conf/RunZ.ini.help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ SearchFullPath=0
; 搜索完整路径,否则只搜文件名
TCMatchPath=Lib\TCMatch\tcmatch.dll
; tcmatch.dll 地址,如果没有则使用 InStr 匹配
ReloadTCMatchInternal=1000
; 每使用 tcmatch.dll 搜索多少次后重载一次,因为 tcmatch.dll 有内存泄漏
; 如果文件较多,可以将此值调大,但会占用更多内存
SaveInputText=0
; 退出时保存编辑框内容
RunOnce=0
Expand Down
7 changes: 6 additions & 1 deletion Lib/TCMatch.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ TCMatchOn(dllPath = "")
}
}

if (!g_ReloadTCMatchInternal > 0)
{
g_ReloadTCMatchInternal := 1000
}

g_TCMatchModule := DllCall("LoadLibrary", "Str", g_TCMatchDllPath, "Ptr")
return g_TCMatchModule
}
Expand All @@ -39,7 +44,7 @@ TCMatch(aHaystack, aNeedle)
; 这个函数有内存泄漏...
static matchTimes := 0
matchTimes++
if (matchTimes > 1000)
if (matchTimes > g_ReloadTCMatchInternal)
{
TCMatchOff()
TCMatchOn()
Expand Down
2 changes: 2 additions & 0 deletions RunZ.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ global g_CurrentInput
global g_CurrentCommand
; 当前匹配到的所有命令
global g_CurrentCommandList
; 每使用 tcmatch.dll 搜索多少次后重载一次,因为 tcmatch.dll 有内存泄漏
global g_ReloadTCMatchInternal := g_Conf.Config.ReloadTCMatchInternal
; 是否启用 TCMatch
global g_EnableTCMatch = TCMatchOn(g_Conf.Config.TCMatchPath)
; 列表第一列的首字母或数字
Expand Down

0 comments on commit 6471f70

Please sign in to comment.