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

Unsure about player group leak

Status
Not open for further replies.
Level 7
Joined
Jul 4, 2007
Messages
249
Does this need to be destroyed to avoid leak? It is never re-defined just in a loop of adding and removing players so I guess it should be fine right?

upload_2021-1-30_23-8-43.png
 

Attachments

  • upload_2021-1-30_23-6-39.png
    upload_2021-1-30_23-6-39.png
    24.6 KB · Views: 15

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,535
A Leak is when you lose access to something that is no longer needed, therefore it exists in the game's memory forever. As long as you have access to tempPlayerGroup, it's not leaking.

Now if you were to create a NEW tempPlayerGroup, you would lose access to the old one, and the old one would be considered a Leak.

I would rename that variable from tempPlayerGroup to something else because "temp" implies that it's only going to exist temporarily (create/use/destroy), but you create it only once and use it for the rest of the game.
 
Last edited:
Status
Not open for further replies.
Top