• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Avoid memory leak - what dead units are to be removed ?

Status
Not open for further replies.
Hello,

I'm developing a Hero Defense map. Since it's the concept, many ennemy units & heroes die during the game.

I want to be sure to avoid memory leakage when the game time passes, so can you please help me figuring out what units are automatically removed by the WarcraftIII engine, and which ones need to be removed manually by triggers.

Depending on:
- Hero or not (I don't want to ressurect the heroes btw)
- Raisable or not
- Decayable or not

Maybe others parameters that I don't know ?

Also what's the best way to remove them ? Something like the one below ?

  • Events
    • Unit - a unit Dies
  • Conditions
    • <Conditions to be answered>
  • Actions
    • Custom script: local unit u = GetTriggerUnit()
    • Wait XX seconds // Enough time for decay/raise... to be over/impossible ?
    • call RemoveUnit(u)
PS: for info if necessary I've a unit indexer
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,286
What Tasyen is saying is correct. Reviveable dead heroes is limited so cannot leak. Care must be taken if some heroes need to be revived or they might unintentionally get removed by this mechanic.

It is my understanding that all units leak a very small amount. Some people claim that Warcraft III periodically cleans this up, but I have not seen evidence to support this. I also have not checked this in recent patches, which might have fixed the issue as part of Reforged development. The leak can be considered trivial for the most part due to how little memory it is (a few kb per unit) with the main issue being stability over time. Even still 20,000 units per playthrough should still be fine which is enough for over 2 units being killed per second for over 2 hours. Even the most spammy hero defences struggle to rank up such numbers.
 
Status
Not open for further replies.
Top