Native GroupEnumUnitsInRange() leaks?

AsiaPingPong

New Member
Reaction score
0
Attached is the test map.

I just used the following function to test for leaks with the GroupEnumUnitsInRange() native, and war3's memory usage skyrocketed.

JASS:
function SafeFilter takes nothing returns boolean
    return true
endfunction

function Trig_Leak_Test_Actions takes nothing returns nothing
    local group g = CreateGroup()
    local boolexpr b = Condition(function SafeFilter)
    call GroupEnumUnitsInRange(g, 0, 0, 1024, b)
    call DestroyBoolExpr(b)
    call DestroyGroup(g)
    set b = null
    set g = null
endfunction

//===========================================================================
function InitTrig_Leak_Test takes nothing returns nothing
    set gg_trg_Leak_Test = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Leak_Test, 0.001 )
    call TriggerAddAction( gg_trg_Leak_Test, function Trig_Leak_Test_Actions )
endfunction

Now, if the single line "call GroupEnumUnitsInRange(g, 0, 0, 1024, b)" is commented out, there are no leaks at all.

Can anyone find any flaws in my test? If not, then this native function must leak.
 

Attachments

  • leak test.w3m
    12.7 KB · Views: 165

simonake

New Member
Reaction score
72
I'm not working with jass but let me expect that it might be a missing nunber right here

set gg_trg_Leak_Test = CreateTrigger( :)HERE:) )

Has i said before i'm not using jass but it might be that missing number of name
 

bOb666777

Stand against the ugly world domination face!
Reaction score
117
I'm not working with jass but let me expect that it might be a missing nunber right here

set gg_trg_Leak_Test = CreateTrigger( :)HERE:) )

Has i said before i'm not using jass but it might be that missing number of name

No, CreateTrigger takes nothing

Back to the topic, did you try call GroupEnumUnitsInRange(g, 0, 0, 1024, null)?
 

Azlier

Old World Ghost
Reaction score
461
>Back to the topic, did you try call GroupEnumUnitsInRange(g, 0, 0, 1024, null)?

That would leak a boolexpr. Have you tried using a global boolexpr instead, and a global group? That way, you don't have to recreate or destroy anything.
 
Reaction score
341
JASS:
globals
    boolexpr b
endglobals

function SafeFilter takes nothing returns boolean
    return true
endfunction

function Trig_Leak_Test_Actions takes nothing returns nothing
    local group g = CreateGroup()
    //call GroupEnumUnitsInRange(g, 0, 0, 1024, b)
    call DestroyGroup(g)
    set g = null
endfunction

//===========================================================================
function InitTrig_Leak_Test takes nothing returns nothing
    set gg_trg_Leak_Test = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Leak_Test, 0.001 )
    call TriggerAddAction( gg_trg_Leak_Test, function Trig_Leak_Test_Actions )
    set b = Condition(function SafeFilter)
endfunction


Caused no memory increase, though when it's not commented, it did. Something is leaking.

Or maybe that function just takes alot of memory, though, wouldn't the memory usage go back down after the function is called?


EDIT:

After some testing, this caused a more stable memory usage.

JASS:
globals
    boolexpr b
    group g = CreateGroup()
endglobals

function SafeFilter takes nothing returns boolean
    return true
endfunction

function Trig_Leak_Test_Actions takes nothing returns nothing
    call GroupEnumUnitsInRange(g, 0, 0, 1024, b)
endfunction

//===========================================================================
function InitTrig_Leak_Test takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterTimerEvent(t, 0.001, true)
    call TriggerAddAction(t, function Trig_Leak_Test_Actions )
    set b = Condition(function SafeFilter)
    set t = null
endfunction
 

Kenny

Back for now.
Reaction score
202
It doesn't necessarily cause a leak, as normal leaks use up memory and never free it. However in the case of groupenum functions using dynamic groups, the memory is eventually free'd. Warcraft just grabs the extra memory to use and does not release it for a while.

Using a global group will definately reduce the memory usage though. And its only really important not to use dynamic groups when using them in high frequency periodic timers. And even then you would need a lot of groupenum functions per 0.02 seconds (for example) to make sufficient lag (which will eventually be reduced by warcraft).
 

Viikuna

No Marlo no game.
Reaction score
265
I cant really think a situation where you would need a dynamic group.

It is easy enought to recycle structs group members, and you can also use some system like GroupUtils for recycling groups.

Its funny how functions like DestroyGroup and DestroyTimer have become useless.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/
  • The Helper The Helper:
    I think we need to add something to the bottom of the front page that shows the Headline News forum that has a link to go to the News Forum Index so people can see there is more news. Do you guys see what I am saying, lets say you read all the articles on the front page and you get to the end and it just ends, no kind of link for MOAR!
  • The Helper The Helper:
    Happy Wednesday!
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    Sticking with the desserts for now the latest recipe is Fried Apple Pies - https://www.thehelper.net/threads/recipe-fried-apple-pies.194297/
  • The Helper The Helper:
    Finally finding about some of the bots that are flooding the users online - bytespider apparently is a huge offender here - ignores robots.txt and comes in from a ton of different IPs

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top