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

With regard to destroying and nullifying global groups.

Status
Not open for further replies.
No, you don't have to. If you need the group later on, it is a bit redundant to destroy, null, and then recreate it. Instead, you can just keep the group the entire time and just reuse it over and over.

See this tutorial for a technique that might be what you're looking for:
http://www.thehelper.net/threads/how-to-use-groups-without-leaking.123810/

It is a bit dated (ex: inputting null doesn't leak anymore), but just look at the technique of using one group for everything.
 
Level 11
Joined
Oct 11, 2012
Messages
711
No, you don't have to. If you need the group later on, it is a bit redundant to destroy, null, and then recreate it. Instead, you can just keep the group the entire time and just reuse it over and over.

See this tutorial for a technique that might be what you're looking for:
http://www.thehelper.net/threads/how-to-use-groups-without-leaking.123810/

It is a bit dated (ex: inputting null doesn't leak anymore), but just look at the technique of using one group for everything.

Thanks for the reply and the link. I kinda agree with you, but Maker thinks differently:
http://www.hiveworkshop.com/forums/...oc-getspelltargetloc-leak-243103/#post2431788

So I am confused. LOL

Edit:
may be locations are different from groups?

Edit:
@PurgeandFire, according to the tutorial, do you think the "filter action" method is better than the "FirstOfGroup" method? There seems to be some debate about this.
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
He was recommending you to use green coding practices and recycle the group instead of creating, using and destroying it as required. The advantage is that it completely avoid all overhead of managing object creation and removal.

The best example I can think of is the standard constant global group type that map makers should be using for all instantaneous unit filters. This is placed in a global that has a very short name for even higher performance and never is destroyed, only cleared and refilled as required.

Since filters have no need for group persistence and generally do not cause threads to run mid-way through execution, this approach is safe. Even if thread interruption does occur, it is only a problem if that thread then requires use of the group while it is still in use by the other thread. You could probably add a debug tagged lock to allow you to check for such an occurrence during map testing.

The speed up is significant.

Standard way of filter...
local group = CreateGroup()
populatewithunits(group)
filtergroup(group)
call DestroyGroup(group)
set group = null

Green way of filter...
globals
group greengroup = CreateGroup()
endglobals

populatewithunits(greengroup) // usually discards existing content of group so no need to pre-empty
filtergroup(greengroup) // usually empties group so no need to post-empty

This is a saving of 3 operations for every filter.
 
Status
Not open for further replies.
Top