yeeboys 发表于 2017-4-20 12:13:40

这个函数会泄露吗

这个fun1函数会点泄露吗,DistanceBetweenPoints 中的点location locA, location locB没有删除和set null

function DistanceBetweenPoints takes location locA, location locB returns real
    local real dx = GetLocationX(locB) - GetLocationX(locA)
    local real dy = GetLocationY(locB) - GetLocationY(locA)
    return SquareRoot(dx * dx + dy * dy)
endfunction




function func1 takes nothing returns nothing
local location A = GetUnitLoc(unit_a)
local location B = GetUnitLoc(unit_b)
local real dist = DistanceBetweenPoints(A,B)
call RemoveLocation(A)
call RemoveLocation(B)
set A = null
set B = null
endfunction

页: [1]
查看完整版本: 这个函数会泄露吗