| 12-01-2003, 07:03 PM | #1 |
// Create the filter local filterfunc myFilter = Filter(function LessThan20ManaCallback) // Add all satisfying units in 'someRect' into 'myGroup' call GroupEnumUnitsInRect(myGroup, someRect, myFilter) // Destroy the filter if we are not going to use it again call DestroyFilter(myFilter) The bolded part destroys the filter that was created above to avoid memory leaks. But what about this: // Add all satisfying units in 'someRect' into 'myGroup' call GroupEnumUnitsInRect(myGroup, someRect, Filter(function LessThan20ManaCallback)) Is the filter destroyed in this case automatically? It should anyway, but you never know. Does the same happen to Condition(), etc.? |
| 12-01-2003, 07:37 PM | #2 |
the filter won't be destroyed. And you wouldn't be able to destroy it because you don't have a variable so better use locals. It's the same for conditions Note: It's always a good idea to set a destroyed variable to null aftwerwards eg set myFilter = null |
| 12-01-2003, 07:42 PM | #3 |
Okay, thanks. *Grumble* stupid Blizzard *Grumble* We should form a mob and demand an ingame garbage collector. ://// |
