• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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

Status
Not open for further replies.

Sverkerman

Hosted Project: BoW
Level 17
Joined
Feb 28, 2010
Messages
1,325
  • 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:

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,180
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.
 

Sverkerman

Hosted Project: BoW
Level 17
Joined
Feb 28, 2010
Messages
1,325
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?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
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.
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
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
Joined
Feb 28, 2010
Messages
1,325
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.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,180
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.
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
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 :grin:
 

Sverkerman

Hosted Project: BoW
Level 17
Joined
Feb 28, 2010
Messages
1,325
Yes because the unit is still dying obviously, via the explosion method. You got a lot to learn mate. :wink:

I never asked about your opinion Eric and I really do appreciate that you sent a administrator on my ass. *blocked*

ehmmm...
Futher question reguarding the condition "Unit is equal to null" - How would that condition look like?
 
Level 8
Joined
Feb 17, 2007
Messages
368
I never asked about your opinion Eric and I really do appreciate that you sent a administrator on my ass. *blocked*

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. :wink:
 

Sverkerman

Hosted Project: BoW
Level 17
Joined
Feb 28, 2010
Messages
1,325
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. :wink:

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.

*THREAD CLOSED*
 
Status
Not open for further replies.
Top