# [Solved] + 4 rep to whoever helps me solve this leak!

Status
Not open for further replies.

#### Sverkerman

Hosted Project: BoW
Level 17
• StoneKill Loop
• Events
• Time - Every 0.05 seconds of game time
• Conditions
• Actions
• Unit Group - Pick every unit in RockThrowGroup and do (Actions)
• Loop - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Load (Key rockloops) of (Key (Picked unit)) from RockThrowHashtable) Greater than 0
• Then - Actions
• Set Temp_Point[1337] = (Position of (Load (Key rockthrowdummy) of (Key (Picked unit)) in RockThrowHashtable))
• Set Temp_UnitGrp[1337] = (Units within 100.00 of Temp_Point[1337])
• Set RockThrowCaster = (Picked unit)
• Unit Group - Pick every unit in Temp_UnitGrp[1337] and do (Actions)
• Loop - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• ((Picked unit) belongs to an enemy of (Owner of RockThrowCaster)) Equal to True
• Then - Actions
• Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
• Special Effect - Destroy (Last created special effect)
• Unit - Kill (Picked unit)
• Else - Actions
• Custom script: call DestroyGroup(udg_Temp_UnitGrp[1337])
• Set Temp_Point[1338] = (Temp_Point[1337] offset by 40.00 towards (Facing of (Load (Key rockthrowdummy) of (Key (Picked unit)) in RockThrowHashtable)) degrees)
• Unit - Move (Load (Key rockthrowdummy) of (Key (Picked unit)) in RockThrowHashtable) instantly to Temp_Point[1338]
• Custom script: call RemoveLocation(udg_Temp_Point[1337])
• Custom script: call RemoveLocation(udg_Temp_Point[1338])
• Hashtable - Save ((Load (Key rockloops) of (Key (Picked unit)) from RockThrowHashtable) - 1) as (Key rockloops) of (Key (Picked unit)) in RockThrowHashtable
• Else - Actions
• Set Temp_Point[1339] = (Position of (Load (Key rockthrowdummy) of (Key (Picked unit)) in RockThrowHashtable))
• Special Effect - Create a special effect at Temp_Point[1339] using Abilities\Spells\Human\StormBolt\StormBoltMissile.mdl
• Special Effect - Destroy (Last created special effect)
• Special Effect - Create a special effect at Temp_Point[1339] using Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
• Special Effect - Destroy (Last created special effect)
• Special Effect - Create a special effect at Temp_Point[1339] using Abilities\Spells\Other\Volcano\VolcanoDeath.mdl
• Special Effect - Destroy (Last created special effect)
• Custom script: call RemoveLocation(udg_Temp_Point[1339])
• Unit - Remove (Load (Key rockthrowdummy) of (Key (Picked unit)) in RockThrowHashtable) from the game
• Unit Group - Remove (Picked unit) from RockThrowGroup
• Hashtable - Clear all child hashtables of child (Key (Picked unit)) in RockThrowHashtable
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Number of units in RockThrowGroup) Equal to 0
• Then - Actions
• Trigger - Turn off (This trigger)
• Else - Actions
Where does this leak? It is used for my latest project which will be released as soon as this leak is fixed.

+4 rep to whoever helps me solve this.

Last edited:

#### chobibo

Level 22
I can't read it even when the picture is zoomed.

#### Marsal

Level 16
me2
click on your trigger's name inside the trigger with the right button-> copy as text and insert here between these tags:
JASS:
``[TRIGGER][/TRIGGER]``

#### Maker

Level 37
I don't see any leaks there, they seem to be correctly cleared.

However seeing the triggers more clearly might paint a different picture.

You should move the "number of unit in group" check to right after "remove unit from group" line.

#### Dr Super Good

Spell Reviewer
Level 64
Unit - Kill (Picked unit)
Unit - Remove (Load (Key rockthrowdummy) of (Key (Picked unit)) in RockThrowHashtable) from the game
Both these leak units. The only way to leaklessly remove a unit is to make the unit explode on death and then kill it. This is apparently a major blizzard bug. There is no way to leaklessly remove heroes this means.

#### NightElf125

Level 8
^Really?.... Wow I never knew that.

#### Sverkerman

Hosted Project: BoW
Level 17
The leak isn't minor. Let the game run for 10 minutes and the framerate drops to extreamly low. The leak is not to remove or not to remove a unit. It has to do with the unit groups somehow or the script to be incorrect.

Anyone that manages to solve this?

#### Dr Super Good

Spell Reviewer
Level 64
I also heard special effects leak even if removed (again a blizzard bug).

#### Bribe

Level 51
I let a projectile system run for a good half hour with hundreds of projectiles on the screen at any given time, just using ExplodeUnitBJ, no lag or RAM consumption. Recycling dummies seems to be a waste of time.

#### Sverkerman

Hosted Project: BoW
Level 17
I let a projectile system run for a good half hour with hundreds of projectiles on the screen at any given time, just using ExplodeUnitBJ, no lag or RAM consumption. Recycling dummies seems to be a waste of time.

I dont understand anything of that at all. What is ExplodeUnitBJ?

#### Maker

Level 37
I dont understand anything of that at all. What is ExplodeUnitBJ?

In GUI it's
• Unit - Explode (*some unit*)
Apparently just killing or removing a unit from the game causes a leak. But using ExplodeUnit when the unit is no more needed averts the leak.

It was thought that it is better to recycle units, usually dummies, instead of creating a new one. Let's say you have a custom projectile system. All projectiles are infact dummy units. When the projectile hits something, it should be destroyed. But you could store the projectile for later use, to be used when another projectile is needed. So instead of creating new projectiles all the time, you check whether there are available prpjectiles that have been used, but are not currently used.

That of course adds complexity to the system. What Bribe says is that adding that complexity, recycling the dummies is unnecessary since creating new units and getting rid of them with ExplodeUnit doesn't create leaks or increase memory allocation endlessly in any way.

#### Dr Super Good

Spell Reviewer
Level 64
He said it is not the cause... (so I assume he fixed it and tried already).

#### D4RK_G4ND4LF

Level 19
why are you using arrays if a single variable would be enough?
that's a big waste of memory
it's like you are buying a train to get to your neighbours house

it might be possible that the special effects you are creating are somehow prone to leak
disable them and try again
if it works after that create a dummy unit and play its death animation and hide it afer a short duration and use it over and over again

and you can't just give "4 rep"
you need a higher reputation count for that or spam rep to random people first which is not the purpose of it

Recycling dummies seems to be a waste of time.

you can only create a rather small number of dummies per second without lags
but if you recycle the dummies you can have like 600 at 30 fps if you could normally have only 200 at the same framerate (at least on my pc)

#### Sverkerman

Hosted Project: BoW
Level 17
why are you using arrays if a single variable would be enough?
that's a big waste of memory
it's like you are buying a train to get to your neighbours house

it might be possible that the special effects you are creating are somehow prone to leak
disable them and try again
if it works after that create a dummy unit and play its death animation and hide it afer a short duration and use it over and over again

and you can't just give "4 rep"
you need a higher reputation count for that or spam rep to random people first which is not the purpose of it

you can only create a rather small number of dummies per second without lags
but if you recycle the dummies you can have like 600 at 30 fps if you could normally have only 200 at the same framerate (at least on my pc)

I will fix all that has been mentioned. If it doesn't work I will update this one.

About rep, I got 4 accounts on this homepage therefor a higher reputation count is not needed.

#### StarZerg

Level 1
Try looking up on the event count down, it repeats every round and could very well cause lagg

#### NightElf125

Level 8
I will fix all that has been mentioned. If it doesn't work I will update this one.

About rep, I got 4 accounts on this homepage therefor a higher reputation count is not needed.

Giving reputation to someone from the same user with multiple accounts, hmmm is that allowed?

#### Dr Super Good

Spell Reviewer
Level 64
why are you using arrays if a single variable would be enough?
that's a big waste of memory
Yes for 1998 it is a huge waste of memory. For 2011 you waste more meory receiving messages from THW chat while playing WC3.

I do admit though that you are better off avoiding arrays unlss you really need their indicies as it is faster but the memory excuse is prety lame.

#### D4RK_G4ND4LF

Level 19
Yes for 1998 it is a huge waste of memory. For 2011 you waste more meory receiving messages from THW chat while playing WC3.

I do admit though that you are better off avoiding arrays unlss you really need their indicies as it is faster but the memory excuse is prety lame.

better we tell him now before he moves to JASS and uses it in functions

#### Sverkerman

Hosted Project: BoW
Level 17
I have a question reguarding the "Unit - Make Unit Expload" Trigger. When I use it to "leakfreely" remove a unit from the game, will that then trigger this event "Unit - A unit dies" ?

#### NightElf125

Level 8
Yes because the unit is still dying obviously, via the explosion method. You got a lot to learn mate.

#### Dr Super Good

Spell Reviewer
Level 64
You can prevent it from firing by testing if the killing unit is not null.

#### Sverkerman

Hosted Project: BoW
Level 17
Yes because the unit is still dying obviously, via the explosion method. You got a lot to learn mate.

ehmmm...
Futher question reguarding the condition "Unit is equal to null" - How would that condition look like?

#### NightElf125

Level 8

ehmmm...
Futher question reguarding the condition "Unit is equal to null" - How would that condition look like?

You never didn't ask for my opinion either Adrian. And you gotta follow the forum rules mate, that isnt allowed and your no different from anyone else.

#### Sverkerman

Hosted Project: BoW
Level 17
You never didn't ask for my opinion either Adrian. And you gotta follow the forum rules mate, that isnt allowed and your no different from anyone else.

Get off my face alrdy?

Also, Thanks everyone for helping an old croc fan out. All leaks removed everything works great! Project will be released within 1-2 days.

Status
Not open for further replies.

Replies
3
Views
683
Replies
6
Views
672
[Trigger] Hashtable problems
Replies
4
Views
729
Replies
6
Views
870
Replies
3
Views
1K