回复 17# Ycxw2008
我以前经常这样做,但现在不了,倒不是因为我知道解析器会自动将其释放,而是因为在函数尾部加几句“$XXX=0”、“$YYY=0”会使代码看起来很不美观,我是彻头彻尾的唯美主义者。测试以下代码:MsgBox(0, "", "test")
; $tBuffer = _Test()
_Test()
MsgBox(0, "", "done")
Func _Test()
Local $iBytesToAllocate = 1024 * 1024 * 1024 * 4
; 创建一个4 GB的缓冲区。
$tBuffer = DllStructCreate("ubyte[" & $iBytesToAllocate & "]")
MsgBox(0, "", DllStructGetPtr($tBuffer))
; Return $tBuffer
EndFunc ;==>Test
注意使用taskmgr观察AU3进程的内存使用情况。
32位系统应将$iBytesToAllocate改为一个较小的值,如1024 * 1024 * 512。 |