| 06-30-2006, 03:41 PM | #1 |
This code seems to leak like hell, after Ive cast the spell like 10-15 times it starts to chop heavily. JASS:function UnitDamageTargetMJ takes unit caster, unit target, real damage, boolean instant, boolean frost, real frostdur, string hiteffect returns nothing local real x1 local real x2 local real y1 local real y2 local real dist local effect eff if (instant == false) then set x1 = GetUnitX(caster) set x2 = GetUnitX(target) set y1 = GetUnitY(caster) set y2 = GetUnitY(target) set dist = SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)) / 1000.00 call TriggerSleepAction(dist) endif call UnitDamageTarget(caster, target, damage, true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FIRE, WEAPON_TYPE_WHOKNOWS) set eff = AddSpecialEffectTarget( hiteffect, target, "chest" ) call TriggerSleepAction(0.50) call DestroyEffect(eff) set eff = null set caster=null set target=null endfunction function Trig_Spells_Necromancer_Actions takes nothing returns nothing local unit caster = GetTriggerUnit() local unit target = GetSpellTargetUnit() local integer abilityid = GetSpellAbilityId() if abilityid == 'A006' then //Dark Bolt call TriggerSleepAction(0.50) call UnitDamageTargetMJ( caster, target, 40, false, false, 0.00, "Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayTarget.mdl" ) set caster = null set target = null set abilityid = 0 return endif endfunction anyone can see any leaks? |
| 06-30-2006, 03:44 PM | #2 |
JASS:set caster = null set target = null In the second function, you forgot to null the abovementioned. You dont need to null function arguments either in the first function. I don't see why it'd get super choppy. Unless you're calling it A LOT or using very huge SFX or something. |
| 06-30-2006, 03:46 PM | #3 |
doesnt they get nullified by JASS:
set caster = null
set target = null
set abilityid = 0
(btw this isnt the whole code, sliced it off after the part which I knows lags) Here's the whole second function: JASS:function Trig_Spells_Necromancer_Actions takes nothing returns nothing local unit caster = GetTriggerUnit() local unit target = GetSpellTargetUnit() local integer abilityid = GetSpellAbilityId() if abilityid == 'A006' then //Dark Bolt call TriggerSleepAction(0.50) call UnitDamageTargetMJ( caster, target, 40, false, false, 0.00, "Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayTarget.mdl" ) set caster = null set target = null set abilityid = 0 return elseif abilityid == 'A003' then // call funci2(caster, GetUnitAbilityLevel(caster, 'A005'), 1800.00) set caster = null set target = null set abilityid = 0 return elseif abilityid == 'A004' then // call funci3(target, GetUnitAbilityLevel(caster, 'A01B'), 30.00) set caster = null set target = null set abilityid = 0 return elseif abilityid == 'A005' then // call DoTMJ(caster, target, 3.00, 5, 40.00, "Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayDamage.mdl", 'A01|') set caster = null set target = null set abilityid = 0 return elseif abilityid == 'A007' then //Summon Nether Dragon call SummonNetherDragon(caster) set caster = null set target = null set abilityid = 0 return endif set caster = null set target = null set abilityid = 0 endfunction |
| 06-30-2006, 04:17 PM | #4 |
Passed values do not need to be nullified. I cannot see any other possible reasons for a leak. |
| 06-30-2006, 04:37 PM | #5 |
Oddly enough there is :S |
| 06-30-2006, 06:07 PM | #6 | |
Quote:
That would have to be quite a major leak. That happens in my experience normally when it is a terrain deformation leak, lots of other leaks, or it isn't a leak (or an event 'leak' causing it to happen lots of times). On balance, I'd say it probably wasn't a leak as such. You're not using test map are you (or having WE open)? |
| 06-30-2006, 06:32 PM | #7 |
Ive been using testmap button for several years with much "laggier" codes and it have never lagged. |
| 06-30-2006, 06:55 PM | #8 |
Restart your computer or something. Because I can assure you, unless something else happens at roughly the same time that causes lag, this baby won't cause any on its own. |
| 06-30-2006, 06:58 PM | #9 |
Ive already restarting, tested this several times and it only lags after 10-15 casts from the spell. The first casts causes no lag, then suddenly it gets really choppy |
| 06-30-2006, 06:58 PM | #10 |
Is this being run from a timer callback or in a group loop? |
| 06-30-2006, 08:22 PM | #12 | |
Quote:
The JASS code seems to call a lot of custom functions my bet is that the leaks are inside one or more of them |
| 06-30-2006, 08:38 PM | #13 |
Nvm, It is now fixed, got help from Shadow1500, it was an "bug" with the base ability Acid Bomb which by using 0 as duration and damage interval as 0 makes an infinite looping which just stacks and well.. you can figure out the outcome |
