找回密码
 点一下
查看: 730|回复: 0

这个函数会泄露吗

[复制链接]
发表于 2017-4-20 12:13:40 | 显示全部楼层 |阅读模式
这个fun1函数会点泄露吗,DistanceBetweenPoints 中的点location locA, location locB没有删除和set null

  1. function DistanceBetweenPoints takes location locA, location locB returns real
  2.     local real dx = GetLocationX(locB) - GetLocationX(locA)
  3.     local real dy = GetLocationY(locB) - GetLocationY(locA)
  4.     return SquareRoot(dx * dx + dy * dy)
  5. endfunction
复制代码




  1. function func1 takes nothing returns nothing
  2. local location A = GetUnitLoc(unit_a)
  3. local location B = GetUnitLoc(unit_b)
  4. local real dist = DistanceBetweenPoints(A,B)
  5. call RemoveLocation(A)
  6. call RemoveLocation(B)
  7. set A = null
  8. set B = null
  9. endfunction
复制代码


您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-11-21 19:55 , Processed in 0.067507 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表