The Unfindable Leak vs Safeness

newtonrox

Member
Reaction score
2
Well, my map leaks... (godamnit!)and it's impossible to figure out why (been months searching it).

When I test my map I push it very hard when compared to the actual game I intend ppl to play.

My map is a footman frenzy-like with 12 player and lots of units...
So I make sure that there is always at least 700 alive units in the map when testing it.
And so, I run the leaky trigger that handles with all units in the map 10x faster than in the normal gameplay.
I'd say that in one hour the trigger runs 240 times, and deals with units 168.000 times.

After 4 hours of game running, the game crashes because of the "not enough memory" problem...

By the way, at normal game speed, the leaky trigger would run 24 times...

The questions are:
So, can I conclude that it will be safe for ppl playing it without wasting effort of some hours of gameplay?
If this just happens after 4 hours of intensive trigger processing, do you think it's possible that is just a normal leak that's within "Warcraft 3" itself and not my programming?


thx for reply...
 
Why don't you make a leak checking trigger and just use that to see? (1)
 
Well, how do you even know that you're leaking, other than the fact that you're lagging? How do you know this isn't just your computer? Could you post the leaking trigger?
 
JASS:
/=======================  Filtro do GroupEnumUnitsInRect()==================//
// Adds the FilterUnit to group udg_ALLMAP or to group udg_ALLMAP2 or to no group, depending on the conditions below:

function Filter_Chuva_On takes nothing returns boolean
local unit F = GetFilterUnit()


if( GetUnitState(F, UNIT_STATE_LIFE) > 0 ) then


   if  ( GetUnitAbilityLevelSwapped('A01W',F ) > 0)  then
   set F = null
   return true
   else
       if ( GetUnitAbilityLevelSwapped('A01X',F ) > 0) then
          call GroupAddUnit(udg_ALLMAP2, F)
          set F = null
          return false
       endif
   endif

endif

set F = null
return false

endfunction
//===========================================================================//




//==================== Adiciona ChuvaTodos =======================================//
function Trig_Chuva_On_T takes nothing returns nothing

     call UnitAddAbility(GetEnumUnit(), 'A003')

endfunction
//===========================================================================//




//==================== Adiciona ChuvaNaga =======================================//
function Trig_Chuva_On_N takes nothing returns nothing

     call UnitAddAbility(GetEnumUnit(), 'A002')

endfunction
//===========================================================================//



function Trig_Chuva_On_Copy_Actions takes nothing returns nothing

      call GroupEnumUnitsInRect(udg_ALLMAP,udg_PlayableArea,Filter(function Filter_Chuva_On) )
         
      call ForGroup(udg_ALLMAP, function Trig_Chuva_On_T )
      call ForGroup(udg_ALLMAP2, function Trig_Chuva_On_N )


      call GroupClear(udg_ALLMAP)
      call GroupClear(udg_ALLMAP2)

endfunction



//===========================================================================
function InitTrig_Chuva_On_Copy takes nothing returns nothing
    set gg_trg_Chuva_On_Copy = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Chuva_On_Copy, function Trig_Chuva_On_Copy_Actions )
endfunction


and

JASS:
//=======================  Filtro do GroupEnumUnitsInRect()==================//
function Chuva_off_Filter takes nothing returns boolean
local unit F = GetFilterUnit()


if( GetUnitState(F, UNIT_STATE_LIFE) > 0 ) then


   if  ( GetUnitAbilityLevelSwapped('A003',F ) > 0)  then
   set F = null
   return true
   else
       if ( GetUnitAbilityLevelSwapped('A002',F ) > 0) then
          call GroupAddUnit(udg_ALLMAP2, F)
          set F = null
          return false
       endif
   endif
endif

set F = null
return false

endfunction
//===========================================================================//





//==================== Remove ChuvaTodos =======================================//
function Chuva_off_T takes nothing returns nothing

         call UnitRemoveAbility( GetEnumUnit(),'A003')

endfunction
//===========================================================================//



//==================== Remove ChuvaNaga =======================================//
function Chuva_off_N takes nothing returns nothing

    call UnitRemoveAbility( GetEnumUnit(),'A002')

endfunction
//===========================================================================//






function Trig_Chuva_off_Actions takes nothing returns nothing

    call GroupEnumUnitsInRect(udg_ALLMAP,udg_PlayableArea, Filter(function Chuva_off_Filter) )            

    call ForGroup(udg_ALLMAP, function Chuva_off_T )
    call ForGroup(udg_ALLMAP2, function Chuva_off_N)

    call GroupClear(udg_ALLMAP)
    call GroupClear(udg_ALLMAP2)

endfunction

//===========================================================================
function InitTrig_Chuva_off takes nothing returns nothing
    set gg_trg_Chuva_off = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Chuva_off, function Trig_Chuva_off_Actions )
endfunction



What I figure out so far is that those triggers leak when all the 700 units are killing themselves and spawning.
There must be death for it to leak.
When I run the map with the units but I let them be at their base (that means no fighting,no death,no spawning), I can run the map indefinetely (I tested it for 12 hours and them I quit the game myself)...
 
[LJASS]ForGroup[/LJASS] leaks, just filter the units and do your actions in there.
 
JASS:
//=======================  Filtro do GroupEnumUnitsInRect()==================//
// Adds the FilterUnit to group udg_ALLMAP or to group udg_ALLMAP2 or to no group, depending on the conditions below:

function Filter_Chuva_On takes nothing returns boolean
local unit F = GetFilterUnit()


if( GetUnitState(F, UNIT_STATE_LIFE) > 0 ) then


   if  ( GetUnitAbilityLevelSwapped('A01W',F ) > 0)  then



       call UnitAddAbility(F, 'A003')





   else
       if ( GetUnitAbilityLevelSwapped('A01X',F ) > 0) then
 

             call UnitAddAbility(F, 'A002')



       endif
   endif

endif

set F = null
return false

endfunction
//===========================================================================//




//==================== Adiciona ChuvaTodos =======================================//
function Trig_Chuva_On_T takes nothing returns nothing

     call UnitAddAbility(GetEnumUnit(), 'A003')

endfunction
//===========================================================================//




//==================== Adiciona ChuvaNaga =======================================//
function Trig_Chuva_On_N takes nothing returns nothing

     call UnitAddAbility(GetEnumUnit(), 'A002')

endfunction
//===========================================================================//



function Trig_Chuva_On_Copy_Actions takes nothing returns nothing

      call GroupEnumUnitsInRect(udg_ALLMAP,udg_PlayableArea,Filter(function Filter_Chuva_On) )

endfunction



//===========================================================================
function InitTrig_Chuva_On_2 takes nothing returns nothing
    set gg_trg_Chuva_On_2 = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Chuva_On_2, function Trig_Chuva_On_Copy_Actions )
endfunction



JASS:
//=======================  Filtro do GroupEnumUnitsInRect()==================//
function Chuva_off_Filter takes nothing returns boolean
local unit F = GetFilterUnit()


if( GetUnitState(F, UNIT_STATE_LIFE) > 0 ) then


   if  ( GetUnitAbilityLevelSwapped('A003',F ) > 0)  then
        
       call UnitRemoveAbility( F,'A003')

   else
       if ( GetUnitAbilityLevelSwapped('A002',F ) > 0) then
         

          call UnitRemoveAbility( F,'A002')

       endif
   endif
endif

set F = null
return false

endfunction
//===========================================================================//




function Trig_Chuva_off_Actions takes nothing returns nothing

    call GroupEnumUnitsInRect(udg_ALLMAP,udg_PlayableArea, Filter(function Chuva_off_Filter) )            

endfunction

//===========================================================================
function InitTrig_Chuva_off_Copy takes nothing returns nothing
    set gg_trg_Chuva_off_Copy = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Chuva_off_Copy, function Trig_Chuva_off_Actions )
endfunction


I modified the triggers according to Jesus4life and Exid (group less enumerating).
after some hours this is what I got:



its written "not enough memory to process this command"
 
You are probably leaking somewhere else, then.
 
that's what i thought but if I turn off those 2 triggers the game will never crash...
that's why I say it's unfindable T_T
 
Well you're leaking somewhere, you just need to find it. Review every trigger, or ask a JASS Master to read your code and look themselves.
 
Ok guys thx for motivating lol XD

As I said before the error just happens when the units kill themselves, so it be could something related to spawning right?

here's my spawn trigger:

JASS:
function Trig_SpawnUnits_Actions takes nothing returns nothing
local integer OwnerN = udg_TierOwner
local unit U = udg_Farm[OwnerN]
local location A  = GetUnitLoc(U)
local location L = GetUnitRallyPoint(U) 


       set udg_TierOwner = 0





 


if ( GetPlayerState(udg_Players[OwnerN], PLAYER_STATE_RESOURCE_FOOD_USED) < 70   ) then

       call CreateNUnitsAtLocFacingLocBJ( 1, udg_TierUnit[OwnerN], udg_Players[OwnerN], A, A )
       set udg_Spawned_Unit = GetLastCreatedUnit()



       call IssuePointOrderLocBJ( udg_Spawned_Unit, "move", L )


endif






call RemoveLocation (A)
call RemoveLocation(L)
set L = null
set U = null
set A = null
endfunction

//===========================================================================
function InitTrig_SpawnUnits takes nothing returns nothing
    set gg_trg_SpawnUnits = CreateTrigger(  )
    call TriggerAddAction( gg_trg_SpawnUnits, function Trig_SpawnUnits_Actions )
endfunction
 
tsk tsk, too many BJs.
Too many inefficiencies.

And a little too much white space ._.
Isn't there a way to get a RallyPoint's X-Y instead of a loc?
JASS:
set u = CreateUnit(/*Stuff*/)
call IssuePointOrder(u, "move", GetLocX(), GetLocY())
 


I'm pretty sure that line leaks. Also,

JASS:
//!  newtonrox
       call CreateNUnitsAtLocFacingLocBJ( 1, udg_TierUnit[OwnerN], udg_Players[OwnerN], A, A )
       set udg_Spawned_Unit = GetLastCreatedUnit()


--->

JASS:
//!  tooltiperror
       set udg_Spawned_Unit=CreateUnitAtLoc(udg_Players[OwnerN],udg_TierUnit[OwnerN],Location(GetLocX(A),GetLocY(A)),0.00)


While I'm at it,

JASS:
//!  tooltiperror
       call IssuePointOrder(CreateUnit(/*Stuff*/), "move", GetLocX(), GetLocY())


edit: Inlining for dummies, anyone?

editedit: You should also follow conventions.
localVariables
CONSTANTS
FunctionNames
GlobalVariables
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top