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

tooltiperror

Super Moderator
Reaction score
231
Why don't you make a leak checking trigger and just use that to see? (1)
 

tooltiperror

Super Moderator
Reaction score
231
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?
 

newtonrox

Member
Reaction score
2
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)...
 

tooltiperror

Super Moderator
Reaction score
231
[LJASS]ForGroup[/LJASS] leaks, just filter the units and do your actions in there.
 

tooltiperror

Super Moderator
Reaction score
231

newtonrox

Member
Reaction score
2
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"
 

tooltiperror

Super Moderator
Reaction score
231
You are probably leaking somewhere else, then.
 

newtonrox

Member
Reaction score
2
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
 

tooltiperror

Super Moderator
Reaction score
231
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.
 

newtonrox

Member
Reaction score
2
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
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
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())
 

tooltiperror

Super Moderator
Reaction score
231


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

      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