• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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,583
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