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

Memory Leaks: Location within Group

Status
Not open for further replies.
Level 5
Joined
May 12, 2008
Messages
77
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.
 
Level 26
Joined
Mar 19, 2008
Messages
3,140
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
77
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