• 🏆 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!

How to Fix Special Effect`s Leaks?

Status
Not open for further replies.
Level 5
Joined
Mar 6, 2015
Messages
130
hello
recently i`m working on remove leaks from my spells but i get stuck in special effects they are leaking as hell ! very leaky! i use 3 methods all of them leaking


First Method :

  • Custom script: set udg_Effect_Dy[udg_TempInt] = AddSpecialEffectLoc(udg_Effect_Dy_model[udg_TempInt], udg_TempLoc)
  • Special Effect - Destroy Effect_Dy[TempInt]
  • Custom script: set udg_Effect_Dy[udg_TempInt]=null
  • Custom script: call RemoveLocation(udg_TempLoc)
Second Method:

  • Special Effect - Create a special effect at TempLoc using Effect_Dy_model[TempInt]
  • Set Effect_Dy[TempInt] = (Last created special effect)
  • Special Effect - Destroy Effect_Dy[TempInt]
  • Custom script: call RemoveLocation(udg_TempLoc)

Third Method:

  • Special Effect - Create a special effect at TempLoc using Effect_Dy_model[TempInt]
  • Special Effect - Destroy (Last created special effect)
  • Custom script: call RemoveLocation(udg_TempLoc)
all of the triggers above leaking any clue to fixing it?
 
Last edited:
Those don't look like they leak. If you run special effects a lot (even if you destroy them in the same trigger - but I do mean a LOT), it can slow down your game. I remember when I was making my Persistent Beam system, I was running special effects every 0.03 seconds and boy did that cause some lag. What I did was to reduce the fequency, using an integer array that counted up until something like 4, which means special effect would create and destroy every .12 seconds. That was enough to remove any fps drop I was experiencing.

Maybe the same thing is happening with you?
 
Do you think it leaks because it is dropping your frame rate/making things go slow?

As others have said, your code isn't leaking. In this case, your situation usually has to do with either: (1) the number of effects you've created (as SpellBound mentioned), or (2) your effect model has a really high particle count.

Optimizing how wc3 handles effects is beyond our control. Your best bet is to reduce the particles in the model or reduce the number of effects you've created--or both!
 
Level 5
Joined
Mar 6, 2015
Messages
130
What makes you think all leaks?


The handle counts:

First Picture indicates the constant Handle Rate means no leak:


usual.jpg



Second Picture Shows the Handle Counts increasing when i use a special effect permanently this is the sign of leaking

Leaking.jpg
 
Delete those lines: does the handle counter still go up? If it does, then your leak is elsewhere.

Handle counting is actually kinda inaccurate for GUI because a few of the GUI functions contain reference leaks (e.g. a lot of the unit group creation functions). The handle counter might go up, but you might not be leaking significantly.
 
Level 5
Joined
Mar 6, 2015
Messages
130
I'm not sure what you use for it, but it might be it decrases some later. Or maybe there is something other leaking.

Maybe but when i disable Special Effects the handle counts won`t be increased like this i have faith in PurgeandFire`s debugging method it`s very accurate i fixed alot of leaks by using this

  • Leak Finder
    • Events
      • Time - Every 0.09 seconds of game time
    • Conditions
    • Actions
      • Set Debug = (Point(0.00, 0.00))
      • Custom script: call BJDebugMsg(I2S(GetHandleId(udg_Debug)-0x100000))
      • Custom script: call RemoveLocation(udg_Debug)
some of the actions increase the handle count but they will be decreased and refreshed after the spell is done the problem is when i using those methods to remove special effects the counter won`t be decreased can anyone present a good way to remove effects leak?
does it related how often spell creates special effects?(like every 0.03 creating one effect)
 
Level 5
Joined
Mar 6, 2015
Messages
130
Delete those lines: does the handle counter still go up? If it does, then your leak is elsewhere.

Handle counting is actually kinda inaccurate for GUI because a few of the GUI functions contain reference leaks (e.g. a lot of the unit group creation functions). The handle counter might go up, but you might not be leaking significantly.

i`m using your old debugging method first of all i want to thank you for presenting it second of some of the GUI functions have a lot of code mistakes like Unit-Pick(in Range) i`m using jass form for these functions
now i have trouble with Special effects the handle count will be increasing as long as the spell creates special effects i mean either when the spell ends or i disable the special effects functions the handle counter will be constant most of the times (or increases then refreshes)
 
Level 7
Joined
Oct 19, 2015
Messages
286
The handle counter you are using is very simple, it just checks a single location, so it can give inaccurate results. It basically just returns the id of the last handle that got recycled, which does not necessarily mean that all the handle ids below that one are taken. If you are using the NewGen editor, you can use a better handle counter like this one which can give you more reliable results.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
Second Picture Shows the Handle Counts increasing when i use a special effect permanently this is the sign of leaking
Which is a sign of reference leaks, not necessarily object leaks.

now i have trouble with Special effects the handle count will be increasing as long as the spell creates special effects i mean either when the spell ends or i disable the special effects functions the handle counter will be constant most of the times (or increases then refreshes)
Even when destroyed, the special effects will only be physically removed once their death animation finishes.

Posting the full trigger might be useful, perhaps you are leaking them in some other way such as due to a logic error.
 
Status
Not open for further replies.
Top