HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Group Variables vs Memory Leak

11-24-2004, 02:44 PM#1
Yamaha R1
I am using a Player Group variable.

Each mini game, the group is defined as all players currently playing, and controlled by a user.

Then I use the group to create units, pan cameras, and award gold.

At the end of each game, I clear the group.

Do I still have to use:
call DestroyGroup (GetLastCreatedGroup())

if I am using a variable this way?
11-24-2004, 03:30 PM#2
a thing
No because only things that aren't variables leak unless you never use the variable again.
11-24-2004, 03:46 PM#3
Yamaha R1
Thanks much.

(Your sig - I havn't used FF much yet, but I did switch to Thunderbird. Although it has some querks in server settings, I am pretty pleased with its overal package. I went from 78 spam emails a day to about 5. Two thumbs up.)
11-24-2004, 07:26 PM#4
AIAndy
I just fear that the way you use it does not reuse the group you already have but overwrites it with a new one instead. In that case you got a leak again.
11-24-2004, 09:51 PM#5
Yamaha R1
I am doing this each round.

Set Game_Players = (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing)))

Then this in all the games.

Player Group - Pick every player in Game_Players and do (Actions)

Then when done, this.

Player Group - Remove all players from Game_Players

Over and over and over.
11-25-2004, 01:58 PM#6
Guest
I guess you could use a loop (For each integer) instead of picking. That don't leaks as far as i know.
11-25-2004, 02:24 PM#7
AIAndy
As I thought. It does leak as All players matching ... creates a new player group that then overwrites the old player group leaking it. So you should destroy the player group before overwriting it.
11-25-2004, 06:08 PM#8
Yamaha R1
Which group do I destroy, my variable group, or 'Last Created Group', and when?

Hey, thanks too.