找回密码
 点一下
查看: 3391|回复: 19

[老贴已解决]这个技能有内存泄露么!

[复制链接]
发表于 2006-6-2 17:24:30 | 显示全部楼层 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2006-6-2 17:30:32 | 显示全部楼层
楼上的家伙,这样写不好吗?
[trigger]Yuesfengbao 复制
    事件
        Unit - A unit Begins casting an ability
    环境
        (Ability being cast) Equal to 雷霆一击 (中立但是带有敌意)
    动作
        Custom script:   local real Real1 = 0.00
        Custom script:   local real Real2 = 0.00
        Custom script:   local unit SkillUnit = null
        Custom script:   local unit Unit1 = null
        Custom script:   local unit Unit2 = null
        Custom script:   local unit Unit3 = null
        Custom script:   local unit Unit4 = null
        Custom script:   local unit Unit5 = null
        Custom script:   local integer Time = 0
        Custom script:   bj_wantDestroyGroup = true
        Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to 邪恶的兽族步兵)) and do (Actions)
            Loop - 动作
                Custom script:   call RemoveUnit( GetEnumUnit() )
                Custom script:   call DestroyGroup( GetLastCreatedGroup() )
        Custom script:   set Time = 30
        Custom script:   set Real1 = 200.00
        Custom script:   set SkillUnit = GetTriggerUnit()
        Custom script:   call CreateNUnitsAtLocFacingLocBJ( 1, \'nchg\', GetOwningPlayer(SkillUnit), PolarProjectionBJ(GetUnitLoc(SkillUnit), 500.00, (  72.00 * 1.00  )), GetUnitLoc(SkillUnit) )
        Custom script:   set Unit1 = GetLastCreatedUnit()
        Custom script:   call CreateNUnitsAtLocFacingLocBJ( 1, \'nchg\', GetOwningPlayer(SkillUnit), PolarProjectionBJ(GetUnitLoc(SkillUnit), 500.00, (  72.00 * 2.00  )), GetUnitLoc(SkillUnit) )
        Custom script:   set Unit2 = GetLastCreatedUnit()
        Custom script:   call CreateNUnitsAtLocFacingLocBJ( 1, \'nchg\', GetOwningPlayer(SkillUnit), PolarProjectionBJ(GetUnitLoc(SkillUnit), 500.00, (  72.00 * 3.00  )), GetUnitLoc(SkillUnit) )
        Custom script:   set Unit3 = GetLastCreatedUnit()
        Custom script:   call CreateNUnitsAtLocFacingLocBJ( 1, \'nchg\', GetOwningPlayer(SkillUnit), PolarProjectionBJ(GetUnitLoc(SkillUnit), 500.00, (  72.00 * 4.00  )), GetUnitLoc(SkillUnit) )
        Custom script:   set Unit4 = GetLastCreatedUnit()
        Custom script:   call CreateNUnitsAtLocFacingLocBJ( 1, \'nchg\', GetOwningPlayer(SkillUnit), PolarProjectionBJ(GetUnitLoc(SkillUnit), 500.00, (  72.00 * 5.00  )), GetUnitLoc(SkillUnit) )
        Custom script:   set Unit5 = GetLastCreatedUnit()
        Custom script:   bj_wantDestroyGroup = true
        Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to 邪恶的兽族步兵)) and do (Actions)
            Loop - 动作
                Unit - Order (Picked unit) to Orc Blademaster - Bladestorm
        Wait 1.50 game-time seconds
        Custom script:   call SetUnitColor( Unit1, PLAYER_COLOR_LIGHT_GRAY )
        Custom script:   call SetUnitColor( Unit2, PLAYER_COLOR_LIGHT_GRAY )
        Custom script:   call SetUnitColor( Unit3, PLAYER_COLOR_LIGHT_GRAY )
        Custom script:   call SetUnitColor( Unit4, PLAYER_COLOR_LIGHT_GRAY )
        Custom script:   call SetUnitColor( Unit5, PLAYER_COLOR_LIGHT_GRAY )
        Custom script:   loop
        Custom script:   set Real2 = Real2 + 50.00
        Custom script:   call IssuePointOrderLocBJ( Unit1, \"move\", PolarProjectionBJ(GetUnitLoc(SkillUnit), Real1, ( ( 72.00 * 1.00 ) + Real2 )) )
        Custom script:   call IssuePointOrderLocBJ( Unit2, \"move\", PolarProjectionBJ(GetUnitLoc(SkillUnit), Real1, ( ( 72.00 * 2.00 ) + Real2 )) )
        Custom script:   call IssuePointOrderLocBJ( Unit3, \"move\", PolarProjectionBJ(GetUnitLoc(SkillUnit), Real1, ( ( 72.00 * 3.00 ) + Real2 )) )
        Custom script:   call IssuePointOrderLocBJ( Unit4, \"move\", PolarProjectionBJ(GetUnitLoc(SkillUnit), Real1, ( ( 72.00 * 4.00 ) + Real2 )) )
        Custom script:   call IssuePointOrderLocBJ( Unit5, \"move\", PolarProjectionBJ(GetUnitLoc(SkillUnit), Real1, ( ( 72.00 * 5.00 ) + Real2 )) )
        Custom script:   exitwhen Time<1
        Custom script:   call TriggerSleepAction( 0.02 )
        Custom script:   set Time=Time-1
        Custom script:   endloop
        Custom script:   call RemoveUnit( Unit1 )
        Custom script:   call RemoveUnit( Unit2 )
        Custom script:   call RemoveUnit( Unit3 )
        Custom script:   call RemoveUnit( Unit4 )
        Custom script:   call RemoveUnit( Unit5 )[/trigger]
回复

使用道具 举报

发表于 2006-6-2 17:32:31 | 显示全部楼层
GetUnitLoc(SkillUnit)…………这样的写法,泄漏的内存不要太多~~~
回复

使用道具 举报

 楼主| 发表于 2006-6-2 18:01:18 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

发表于 2006-6-2 21:08:51 | 显示全部楼层
强……………………………………
回复

使用道具 举报

发表于 2006-6-2 21:16:26 | 显示全部楼层
原帖由 everguo 于 2006-6-2 18:01 发表
啊,不懂:o

不过还是谢谢老大:lol

PS:这里是JASS区,所以我当然要用JASS:P

……………………你这个明显是T,冒充什么jass…………
回复

使用道具 举报

 楼主| 发表于 2006-6-2 21:55:59 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

发表于 2006-6-3 12:50:29 | 显示全部楼层
Yuesfengbao 复制
    事件
        Unit - A unit Begins casting an ability
    环境
        (Ability being cast) Equal to 雷霆一击 (中立但是带有敌意)
    动作
        Custom script:   local real Real1 = 0.00
        Custom script:   local real Real2 = 0.00
        Custom script:   local unit SkillUnit = null
        Custom script:   local unit Unit1 = null
        Custom script:   local unit Unit2 = null
        Custom script:   local unit Unit3 = null
        Custom script:   local unit Unit4 = null
        Custom script:   local unit Unit5 = null
        Custom script:   local integer Time = 0
        Custom script:   local location tempLoc = null

        Custom script:   bj_wantDestroyGroup = true
        Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to 邪恶的兽族步兵)) and do (Actions)
            Loop - 动作
                Custom script:   call RemoveUnit( GetEnumUnit() )
                Custom script:   call DestroyGroup( GetLastCreatedGroup() )
        Custom script:   set Time = 30
        Custom script:   set Real1 = 200.00
        Custom script:   set SkillUnit = GetTriggerUnit()
        Custom script:   set tempLoc = GetUnitLoc(SkillUnit)

        Custom script:   call CreateNUnitsAtLocFacingLocBJ( 1, \'nchg\', GetOwningPlayer(SkillUnit), PolarProjectionBJ(tempLoc, 500.00, (  72.00 * 1.00  )), tempLoc )
        Custom script:   set Unit1 = GetLastCreatedUnit()
        Custom script:   call CreateNUnitsAtLocFacingLocBJ( 1, \'nchg\', GetOwningPlayer(SkillUnit), PolarProjectionBJ(tempLoc, 500.00, (  72.00 * 2.00  )), tempLoc )
        Custom script:   set Unit2 = GetLastCreatedUnit()
        Custom script:   call CreateNUnitsAtLocFacingLocBJ( 1, \'nchg\', GetOwningPlayer(SkillUnit), PolarProjectionBJ(tempLoc, 500.00, (  72.00 * 3.00  )), tempLoc )
        Custom script:   set Unit3 = GetLastCreatedUnit()
        Custom script:   call CreateNUnitsAtLocFacingLocBJ( 1, \'nchg\', GetOwningPlayer(SkillUnit), PolarProjectionBJ(tempLoc, 500.00, (  72.00 * 4.00  )), tempLoc )
        Custom script:   set Unit4 = GetLastCreatedUnit()
        Custom script:   call CreateNUnitsAtLocFacingLocBJ( 1, \'nchg\', GetOwningPlayer(SkillUnit), PolarProjectionBJ(tempLoc, 500.00, (  72.00 * 5.00  )), tempLoc )
        Custom script:   set Unit5 = GetLastCreatedUnit()
        Custom script:   bj_wantDestroyGroup = true
        Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to 邪恶的兽族步兵)) and do (Actions)
            Loop - 动作
                Unit - Order (Picked unit) to Orc Blademaster - Bladestorm
        Wait 1.50 game-time seconds
        Custom script:   call SetUnitColor( Unit1, PLAYER_COLOR_LIGHT_GRAY )
        Custom script:   call SetUnitColor( Unit2, PLAYER_COLOR_LIGHT_GRAY )
        Custom script:   call SetUnitColor( Unit3, PLAYER_COLOR_LIGHT_GRAY )
        Custom script:   call SetUnitColor( Unit4, PLAYER_COLOR_LIGHT_GRAY )
        Custom script:   call SetUnitColor( Unit5, PLAYER_COLOR_LIGHT_GRAY )
        Custom script:   loop
        Custom script:   set Real2 = Real2 + 50.00
        Custom script:   call IssuePointOrderLocBJ( Unit1, \"move\", PolarProjectionBJ(tempLoc, Real1, ( ( 72.00 * 1.00 ) + Real2 )) )
        Custom script:   call IssuePointOrderLocBJ( Unit2, \"move\", PolarProjectionBJ(tempLoc, Real1, ( ( 72.00 * 2.00 ) + Real2 )) )
        Custom script:   call IssuePointOrderLocBJ( Unit3, \"move\", PolarProjectionBJ(tempLoc, Real1, ( ( 72.00 * 3.00 ) + Real2 )) )
        Custom script:   call IssuePointOrderLocBJ( Unit4, \"move\", PolarProjectionBJ(tempLoc, Real1, ( ( 72.00 * 4.00 ) + Real2 )) )
        Custom script:   call IssuePointOrderLocBJ( Unit5, \"move\", PolarProjectionBJ(tempLoc, Real1, ( ( 72.00 * 5.00 ) + Real2 )) )
        Custom script:   exitwhen Time<1
        Custom script:   call TriggerSleepAction( 0.02 )
        Custom script:   set Time=Time-1
        Custom script:   endloop
        Custom script:   call RemoveUnit( Unit1 )
        Custom script:   call RemoveUnit( Unit2 )
        Custom script:   call RemoveUnit( Unit3 )
        Custom script:   call RemoveUnit( Unit4 )
        Custom script:   call RemoveUnit( Unit5 )
        Custom script:   call RemoveLocation( tempLoc )

[ 本帖最后由 amp34 于 2006-6-3 18:33 编辑 ]
回复

使用道具 举报

发表于 2006-6-3 19:12:48 | 显示全部楼层
amp兄不错哈,不如兼任JASS区好了
回复

使用道具 举报

发表于 2006-6-3 19:26:37 | 显示全部楼层
Yuesfengbao 复制
    事件
        Unit - A unit Begins casting an ability
    环境
        (Ability being cast) Equal to 雷霆一击 (中立但是带有敌意)
    动作
        Custom script:   local real Real1 = 0.00
        Custom script:   local real Real2 = 0.00
        Custom script:   local unit SkillUnit = null
        Custom script:   local unit Unit1 = null
        Custom script:   local unit Unit2 = null
        Custom script:   local unit Unit3 = null
        Custom script:   local unit Unit4 = null
        Custom script:   local unit Unit5 = null
        Custom script:   local integer Time = 0
        Custom script:   bj_wantDestroyGroup = true
        Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to 邪恶的兽族步兵)) and do (Actions)
            Loop - 动作
                Custom script:   call RemoveUnit( GetEnumUnit() )
                Custom script:   call DestroyGroup( GetLastCreatedGroup() )
这是一种毫无意义的废操作
        Custom script:   set Time = 30
        Custom script:   set Real1 = 200.00
        Custom script:   set SkillUnit = GetTriggerUnit()
        Custom script:   call CreateNUnitsAtLocFacingLocBJ( 1, \'nchg\', GetOwningPlayer(SkillUnit), PolarProjectionBJ(GetUnitLoc(SkillUnit), 500.00, (  72.00 * 1.00  )), GetUnitLoc(SkillUnit) )
所有这类全是点泄漏
        Custom script:   set Unit1 = GetLastCreatedUnit()
        Custom script:   call CreateNUnitsAtLocFacingLocBJ( 1, \'nchg\', GetOwningPlayer(SkillUnit), PolarProjectionBJ(GetUnitLoc(SkillUnit), 500.00, (  72.00 * 2.00  )), GetUnitLoc(SkillUnit) )
        Custom script:   set Unit2 = GetLastCreatedUnit()
        Custom script:   call CreateNUnitsAtLocFacingLocBJ( 1, \'nchg\', GetOwningPlayer(SkillUnit), PolarProjectionBJ(GetUnitLoc(SkillUnit), 500.00, (  72.00 * 3.00  )), GetUnitLoc(SkillUnit) )
        Custom script:   set Unit3 = GetLastCreatedUnit()
        Custom script:   call CreateNUnitsAtLocFacingLocBJ( 1, \'nchg\', GetOwningPlayer(SkillUnit), PolarProjectionBJ(GetUnitLoc(SkillUnit), 500.00, (  72.00 * 4.00  )), GetUnitLoc(SkillUnit) )
        Custom script:   set Unit4 = GetLastCreatedUnit()
        Custom script:   call CreateNUnitsAtLocFacingLocBJ( 1, \'nchg\', GetOwningPlayer(SkillUnit), PolarProjectionBJ(GetUnitLoc(SkillUnit), 500.00, (  72.00 * 5.00  )), GetUnitLoc(SkillUnit) )
        Custom script:   set Unit5 = GetLastCreatedUnit()
        Custom script:   bj_wantDestroyGroup = true
        Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to 邪恶的兽族步兵)) and do (Actions)
            Loop - 动作
                Unit - Order (Picked unit) to Orc Blademaster - Bladestorm
        Wait 1.50 game-time seconds
        Custom script:   call SetUnitColor( Unit1, PLAYER_COLOR_LIGHT_GRAY )
        Custom script:   call SetUnitColor( Unit2, PLAYER_COLOR_LIGHT_GRAY )
        Custom script:   call SetUnitColor( Unit3, PLAYER_COLOR_LIGHT_GRAY )
        Custom script:   call SetUnitColor( Unit4, PLAYER_COLOR_LIGHT_GRAY )
        Custom script:   call SetUnitColor( Unit5, PLAYER_COLOR_LIGHT_GRAY )
        Custom script:   loop
        Custom script:   set Real2 = Real2 + 50.00
        Custom script:   call IssuePointOrderLocBJ( Unit1, \"move\", PolarProjectionBJ(GetUnitLoc(SkillUnit), Real1, ( ( 72.00 * 1.00 ) + Real2 )) )
这里也一样
        Custom script:   call IssuePointOrderLocBJ( Unit2, \"move\", PolarProjectionBJ(GetUnitLoc(SkillUnit), Real1, ( ( 72.00 * 2.00 ) + Real2 )) )
        Custom script:   call IssuePointOrderLocBJ( Unit3, \"move\", PolarProjectionBJ(GetUnitLoc(SkillUnit), Real1, ( ( 72.00 * 3.00 ) + Real2 )) )
        Custom script:   call IssuePointOrderLocBJ( Unit4, \"move\", PolarProjectionBJ(GetUnitLoc(SkillUnit), Real1, ( ( 72.00 * 4.00 ) + Real2 )) )
        Custom script:   call IssuePointOrderLocBJ( Unit5, \"move\", PolarProjectionBJ(GetUnitLoc(SkillUnit), Real1, ( ( 72.00 * 5.00 ) + Real2 )) )
        Custom script:   exitwhen Time<1
        Custom script:   call TriggerSleepAction( 0.02 )
        Custom script:   set Time=Time-1
        Custom script:   endloop
        Custom script:   call RemoveUnit( Unit1 )
        Custom script:   call RemoveUnit( Unit2 )
        Custom script:   call RemoveUnit( Unit3 )
        Custom script:   call RemoveUnit( Unit4 )
        Custom script:   call RemoveUnit( Unit5 )
unit局部变量没释放



然后这种CS写法简直是有病。。。:L
回复

使用道具 举报

发表于 2006-6-3 19:31:39 | 显示全部楼层
………………我觉得这样写法的人还真值得膜拜
回复

使用道具 举报

发表于 2008-5-11 14:16:40 | 显示全部楼层
还冒充guo
回复

使用道具 举报

发表于 2008-5-11 14:33:41 | 显示全部楼层
谁说这个是冒充的了~~还有不许挖坟~~
回复

使用道具 举报

发表于 2008-5-11 18:46:04 | 显示全部楼层
高人啊,挖到2006年的了

居然发现当时的guo比我还要渣~~~
回复

使用道具 举报

发表于 2008-5-12 12:43:02 | 显示全部楼层
谁都是从渣过来的
回复

使用道具 举报

发表于 2008-5-14 11:57:05 | 显示全部楼层
偶也挖一下,当时大家都好和谐呀.现在前面几位感觉就像劳燕分飞.各奔东西..
回复

使用道具 举报

发表于 2008-5-14 12:02:58 | 显示全部楼层
引用第12楼蕾妮于2008-05-11 14:33发表的  :
谁说这个是冒充的了~~还有不许挖坟~~

我看到这句就想笑~~~~~
回复

使用道具 举报

发表于 2008-5-14 12:12:47 | 显示全部楼层
第一次见到这么多的泄露,开了眼界了!
回复

使用道具 举报

发表于 2008-5-14 12:15:18 | 显示全部楼层
所有的返回植不是integer,real,string,boolean,code 的函数都有泄露,都要处理啊
回复

使用道具 举报

发表于 2008-5-14 12:40:41 | 显示全部楼层
好老,偶民8要踩everyguo滴尸体了

这贴应该可以锁了8~~~~~~~
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-24 18:22 , Processed in 0.034086 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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