'groupenum leaks if you dont use a filter'

substance

New Member
Reaction score
34
JASS:
GroupEnumUnitsInRange(g,x,y,100,null)


Apparently that leaks because it doesnt use a filter.

So what's a way around it? Just make a global boolexp and use it whenever you call a groupenum.

No, I havent tested it so I'm not 100% sure if this is true, but what's the harm if it isnt? =p

Just thought i'd share with you guys because I didnt know and I havent seen a tutorial that has mentioned this and it's kind of a big deal.
 

emjlr3

Change can be a good thing
Reaction score
395
this is true, afaik
 
Reaction score
456
Actually.. Does it really leak if you use nothing as a boolexpr? If it does, it's so small leak ;D
 

substance

New Member
Reaction score
34
> No, I havent tested it so I'm not 100% sure if this is true

Tested what ? Why you tell it leaks ?

I was told by someone from wc3c, apparently it was discussed a while ago on there... but i've never seen anyone say it to the people here on these boards.

Most people who are forced to use a short periodic event, ie. 'Every 0.03 seconds' use groupenum in the function, so if that leaks you can imagine how much power is lost.
 

Sooda

Diversity enchants
Reaction score
318
It' s so imba, when you use filter it still eats performance and not few ! Do unlogical comparison what is always true or even better return just true

JASS:

function AlwaysTrueFilter takes nothing returns boolean
     return true
endfunction

function Test takes nothing returns nothing
     local group allUnits = CreateGroup()
     local boolexpr alwaysTrueFilter = Condition (function AlwaysTrueFilter)

     local real locationX = 0.
     local real locationY = 0.

     call GroupEnumUnitsInRange(allUnits,locationX,locationY,100,alwaysTrueFilter)
endfunction
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
i don't understand how exacly entering a null value instead of boolexpr is leaking?
i mean it's null.... it doesn't contain anything in it, it's like a pass on me action
also the fact that it replace a boolexpr which doesn't leak anyway so if u say he leaks as a boolexpr it's nott exacly true....
and btw u didn't say exacly what it leaks....

>Sooda
i don't know if it would work but it would be easier if u do:
JASS:
function Test takes nothing returns nothing
     local group allUnits = CreateGroup()

     local real locationX = 0.
     local real locationY = 0.

     call GroupEnumUnitsInRange(allUnits,locationX,locationY,100,Condition (true)
endfunction

i never tried to do this but theoretically it should work i think
 

emjlr3

Change can be a good thing
Reaction score
395
at map init create a global boolexpr varialbe, no need to create a new one everytime you need it
 

grim001

New Member
Reaction score
10
a boolean and a boolexpr(filter) are not the same thing.

it isn't technically a leak, it's more like WC3 gobbles more memory every time you do a groupenum with a null filter. It caps eventually but it causes excessively high memory usage and will cause lag before long if you use groupenums often.

put a boolexpr that returns true in a global var and use that instead of null.
 

Vexorian

Why no custom sig?
Reaction score
187
I don't understand why using null there leaks
Nobody does, but it is true.

I used to have something like this:

JASS:

library BoolexprUtils initializer init
    globals 
          boolexpr BOOLEXPR_TRUE
          boolexpr BOOLEXPR_FALSE
    endglobals

    private function rtrue takes nothing returns boolean
          return true
    endfunction

    private function rfalse takes nothing returns boolean
          return false
    endfunction


     private function init takes nothing returns nothing
           set BOOLEXPR_TRUE = Condition(function rtrue)
           set BOOLEXPR_FALSE = Condition(function rfalse)
     endfunction
     
endlibrary


But it is actually useless since because Condition() doesn't create new boolexprs everytime you can just use Condition(function SomethingReturnsTrue) instead, although I think boolexprutils make code easier to read...
 

SFilip

Gone but not forgotten
Reaction score
634
Condition takes code so no, you can't do it that way.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top