Autohotkey AHK WinWait内存使用率

Autohotkey AHK WinWait内存使用率,autohotkey,Autohotkey,我有一个ahk脚本,用于启用Crystal Reports对话框上的打印机按钮,无论出于何种原因,在Server 2008 R2中使用时默认情况下都不会启用该按钮。无论如何。。。我遇到的问题是,进程在运行时会在每个周期继续堆栈内存。这不像我将任何内容存储到一个碰巧未被清除的变量中。在这个过程中,什么使用了不会被释放的内存资源?我可以实现什么来防止这种情况发生 在这个清单中,您可以看到私有内存随着使用量的增加而增加。我最终让它启动了大约5次,从大约1000k到20000K 顶部条目是我从WinWa

我有一个ahk脚本,用于启用Crystal Reports对话框上的
打印机
按钮,无论出于何种原因,在Server 2008 R2中使用时默认情况下都不会启用该按钮。无论如何。。。我遇到的问题是,进程在运行时会在每个周期继续堆栈内存。这不像我将任何内容存储到一个碰巧未被清除的变量中。在这个过程中,什么使用了不会被释放的内存资源?我可以实现什么来防止这种情况发生

在这个清单中,您可以看到私有内存随着使用量的增加而增加。我最终让它启动了大约5次,从大约1000k到20000K

顶部条目是我从
WinWaitActive
转换的测试版本,该版本导致不必要的CPU使用

Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id ProcessName
-------  ------    -----      ----- -----   ------     -- -----------
 58       8     2312       6216    68     0.62   7828 showprinterbutton
 55       8     1788       5508    67    32.39   6840 ShowPSPrinter
 57       8     1864       6028    79    33.12   7184 ShowPSPrinter
 55       8     1396       5084    67     1.29   7604 ShowPSPrinter
 55       8     1796       5536    67    36.36   7856 ShowPSPrinter
 55       8     1772       5444    67    37.27   9848 ShowPSPrinter
 55       8     1740       5424    67    26.33  10300 ShowPSPrinter
 55       8     1396       4992    67     0.84  11348 ShowPSPrinter
 55       8     1396       5024    67     1.14  11460 ShowPSPrinter
 55       8     1736       5604    67   355.93  11676 ShowPSPrinter
 55       8     1396       4984    67     1.06  13364 ShowPSPrinter
 55       8     1396       5132    67     0.81  13516 ShowPSPrinter
 72       9     2048       6500    73    66.36  14072 ShowPSPrinter
 55       8     1792       5504    67    59.92  15736 ShowPSPrinter
 55       8     1400       4960    67     0.61  16340 ShowPSPrinter
 57       8     1496       5848    79     0.98  18516 ShowPSPrinter
 57       8     1500       5404    79     0.98  19048 ShowPSPrinter
 55       8     1400       5000    67     0.51  22020 ShowPSPrinter
下面是我的脚本内容,然后将其编译为EXE运行

; Version: 1.2
; Dated: 03/31/2015 - Created
; Description: Enable a watch for page setup dialog and activate the print button for crystal reports


; Only allow one instance to run
#SingleInstance force 

; Run with out a tray icon
#NoTrayIcon 

; Getting loose with not requiring direct title menu values
SetTitleMatchMode, RegEx

; Start active watch for quick post menu
WaitForPS:
WinWait,Page Setup
{
    Control,Show,,Button8,Page Setup,(optimize for screen display)
    GoSub WaitForPS
}


; End of Script...

在窗口出现并且循环运行一次之后,
WainWait
立即继续执行下一个语句,因为窗口已经存在,启用控件,并再次递归调用循环(
gosub
),例如,代码每秒分配100个堆栈帧,从而最终耗尽调用堆栈

在继续等待窗口关闭之前,请使用and:

Loop
{
    WinWait,Page Setup
    Control,Show,,Button8,Page Setup,(optimize for screen display)
    WinWaitClose
}

搞定了,非常感谢!现在,我可以将其部署到生产环境中,而不必为此而紧张。