• 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.

Memory Leaks: Location within Group

Status
Not open for further replies.
Level 5
Joined
May 12, 2008
Messages
80
Hey guys,

i was wondering if locations that are used to define a unit group have to be destroyed as well, not only the group itself.

a few examples to make this easier to understand:

1. This will cause memory leaks for sure:

  • Test
    • Ereignisse
      • Einheit - A unit Startet den Effekt einer Fähigkeit
    • Bedingungen
    • Aktionen
      • Einheitengruppe - Pick every unit in (Units within 500.00 of (Position of (Casting unit))) and do (Actions)
        • Schleifen - Aktionen
          • Einheit - Explode (Picked unit)
2. This won't cause any leaks (as far as i know)

  • Test
    • Ereignisse
      • Einheit - A unit Startet den Effekt einer Fähigkeit
    • Bedingungen
    • Aktionen
      • Set _Point = (Position of (Casting unit))
      • Custom script: set bj_wantDestroyGroup = true
      • Einheitengruppe - Pick every unit in (Units within 500.00 of _Point) and do (Actions)
        • Schleifen - Aktionen
          • Einheit - Explode (Picked unit)
      • Custom script: call RemoveLocation (udg__Point)
3. But what about this? Is the memory space used by (Position of (Casting unit)) cleaned up or is the destruction of unit group insufficient?

  • Test
    • Ereignisse
      • Einheit - A unit Startet den Effekt einer Fähigkeit
    • Bedingungen
    • Aktionen
      • Custom script: set bj_wantDestroyGroup = true
      • Einheitengruppe - Pick every unit in (Units within 500.00 of (Position of (Casting unit))) and do (Actions)
        • Schleifen - Aktionen
          • Einheit - Explode (Picked unit)

EDIT: Sorry for german language. I think its not relevant to change it.
 
Imagen it like this:
Whenever you want any action to refer to given point (doesn't matter if its set to variable or not) Wacraft3 engine has to calculate it thus you lose some memory. Now when data is stored, you can use it. But what happen when you do not need it anymore? It's becoming useless, and since you havent destroyed it, memory will be occupied till the game ends. Furthermore, you havent set location to any variable, and reference to given poing is quickly lost, giving you no possibility to retieve data back to free up memory.

Thats why position should be set to variables, since variable will 'point' at given location (data piece), and when nessesary can be used to remove all the leaks. So yes, you should always use second egzample to make your triggers bug and lag free.

EDIT My deutsch is poor but at least I understand that you have said: second number Pharaoh_ :DD
 
Level 5
Joined
May 12, 2008
Messages
80
thank you Pharaoh_ and Spinnaker. For some reason i can't give you some rep... Hive told me to spread some around before honoring you again... Maybe you answered one of my questions before.
 
Status
Not open for further replies.
Top