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

Is special effect attached to unit destroy when unit is removed ?

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
Saving the Special Effect into X of Key(Unit) and then using "clear al child of Key(Unit)" would destroy the special effect?
 
Saving the Special Effect into X of Key(Unit) and then using "clear al child of Key(Unit)" would destroy the special effect?

Another good question ^^

but, i understand why it doesn't. The clear all child of Key(Unit) won't remove anything, except the values in the hashtable of the stored things.

But i'm surprised for the remove unit. Because if the effect lose his attachment, normally it should be removed. (i think it's logic, but it's my logic and not computer logic.)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
Leaks from effects attached to removed units are probably not so bad. As the unit art and the effect art should be removed, there is no render load meaning that next to slower trigger systems the leak should have no impact at all.

The reason for the leak is due to JASS having virtually no garbage collector. Thus although all logic states that removing a unit should automatically destroy all attached effects, the JASS interpreter does not. Instead it will probably remove all art involved but the effect object will still remain allocated in memory. It also probably causes an internal unit reference leak but the game probably has than anyway (seeing how all unit creations leak).

Do not except much from JASS seeing as how it can not even keep track of the reference coutner properly when using local handles and forgetting to null them at the end of a function.

Do remember that all leaks are bad. Some leaks might be less survear than others but that is not an excuse to let them occur.
 
Status
Not open for further replies.
Top