HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Lets play find the memory leak >:(

08-29-2005, 05:08 AM#1
drdlord
ok running the following code about once every two seconds for 15 minutes seems to waste 1 meg of memory this code will be run more offten than that in a real game and the game can last an hour or two so it's a major problem:

Trigger 1: Build Unit Top Left
Events
Unit - A unit enters Castle Top Left <gen>
Conditions
((Triggering unit) is A peon-type unit) Equal to False
((Triggering unit) is A structure) Equal to False
Actions
Trigger - Run Unit Cap <gen> (checking conditions)
Set tempUnitGroup = (Units in Castle Top Left <gen> matching ((Matching unit) Equal to (Entering unit)))
Trigger - Run Build Unit Top General <gen> (checking conditions)
Custom script: call DestroyGroup( udg_tempUnitGroup )


Trigger 2: Unit Cap
Events
Conditions
AntiLag Equal to False
Actions
Set tempRegion = (Playable map area)
Set tempUnitGroup = (Units in tempRegion matching (((Owner of (Matching unit)) controller) Equal to Computer))
Custom script: call RemoveRect( udg_tempRegion )
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in tempUnitGroup) Greater than unitCap
Then - Actions
Custom script: call DestroyGroup( udg_tempUnitGroup )
Else - Actions
Custom script: call DestroyGroup( udg_tempUnitGroup )
Skip remaining actions
-------- This trigger is run by the build unit triggers --------
Set AntiLag = True
Game - Display to (All players) the text: Too many units have...
For each (Integer A) from 1 to 10, do (Actions)
Loop - Actions
Set shrineOwners[(Integer A)] = (Owner of shrines[(Integer A)])
Unit - Change ownership of shrines[(Integer A)] to Neutral Passive and Retain color
For each (Integer unitCapWaitCounter) from 1 to 2, do (Actions)
Loop - Actions
Set tempRegion = (Playable map area)
Set tempUnitGroupCompControll = (Units in tempRegion matching (((Owner of (Matching unit)) controller) Equal to Computer))
Custom script: call RemoveRect( udg_tempRegion )
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in tempUnitGroupCompControll) Less than or equal to ((unitCap x 2) / 3)
Then - Actions
Else - Actions
Wait 1.00 seconds
Set unitCapWaitCounter = 0
Custom script: call DestroyGroup( udg_tempUnitGroupCompControll )
Game - Display to (All players) the text: Enough units have b...
For each (Integer A) from 1 to 10, do (Actions)
Loop - Actions
Unit - Change ownership of shrines[(Integer A)] to shrineOwners[(Integer A)] and Retain color
Set AntiLag = False
For each (Integer A) from 1 to 10, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Owner of shrines[(Integer A)]) slot status) Equal to Is playing
Then - Actions
Else - Actions
Set tempPlayerGroup = (All players matching ((((Matching player) slot status) Equal to Is playing) and ((((Matching player) controller) Equal to User) and (((Matching player) is an ally of (Owner of shrines[(Integer A)])) Equal to True))))
Unit - Change ownership of shrines[(Integer A)] to (Random player from tempPlayerGroup) and Change color
Custom script: call DestroyForce( udg_tempPlayerGroup )
08-29-2005, 05:09 AM#2
drdlord
Trigger 3: Build Unit Top General
Events
Conditions
Actions
Unit Group - Pick every unit in tempUnitGroup and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is A flying unit) Equal to True
AirAllowed Equal to False
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Picked unit)) Equal to Baby Dragon lvl 5
Then - Actions
Player - Add 40 to (Owner of (Picked unit)) Current gold
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Picked unit)) Equal to Matured Dragon lvl 15
Then - Actions
Player - Add 880 to (Owner of (Picked unit)) Current gold
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Picked unit)) Equal to Owl Man
Then - Actions
Player - Add 30000 to (Owner of (Picked unit)) Current gold
Else - Actions
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Entering unit)) Equal to Scout lvl 1
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
scoutMade[(Player number of (Owner of (Entering unit)))] Equal to True
Then - Actions
Set scoutMade[(Player number of (Owner of (Entering unit)))] = False
Set Income[(Player number of (Owner of (Entering unit)))] = (Income[(Player number of (Owner of (Entering unit)))] + (Point-value of (Entering unit)))
Else - Actions
Set scoutMade[(Player number of (Owner of (Entering unit)))] = True
Else - Actions
Set Income[(Player number of (Owner of (Entering unit)))] = (Income[(Player number of (Owner of (Entering unit)))] + (Point-value of (Entering unit)))
Set tempPoint = (Center of Spawn Bottom Left2 <gen>)
Unit - Create 1 (Unit-type of (Picked unit)) for (Owner of (Picked unit)) at tempPoint facing Default building facing degrees
Custom script: call RemoveLocation( udg_tempPoint )
Unit - Change ownership of (Last created unit) to Player 11 (Dark Green) and Retain color
Unit Group - Add (Last created unit) to UnitsBottomLeftOuter
Set tempPoint = (Center of Outer Middle Left <gen>)
Unit - Order (Last created unit) to Move To tempPoint
Custom script: call RemoveLocation( udg_tempPoint )
Set tempPoint = (Center of Spawn Bottom Left1 <gen>)
Unit - Create 1 (Unit-type of (Picked unit)) for (Owner of (Picked unit)) at tempPoint facing Default building facing degrees
Custom script: call RemoveLocation( udg_tempPoint )
Unit - Change ownership of (Last created unit) to Player 11 (Dark Green) and Retain color
Unit Group - Add (Last created unit) to UnitsBottomLeftInner
Set tempPoint = (Center of Inner Middle Left <gen>)
Unit - Order (Last created unit) to Move To tempPoint
Custom script: call RemoveLocation( udg_tempPoint )
-------- ------------------ --------
Set tempPoint = (Center of Spawn Bottom Right2 <gen>)
Unit - Create 1 (Unit-type of (Picked unit)) for (Owner of (Picked unit)) at tempPoint facing Default building facing degrees
Custom script: call RemoveLocation( udg_tempPoint )
Unit - Change ownership of (Last created unit) to Player 11 (Dark Green) and Retain color
Unit Group - Add (Last created unit) to UnitsBottomRightOuter
Set tempPoint = (Center of Outer Middle Right <gen>)
Unit - Order (Last created unit) to Move To tempPoint
Custom script: call RemoveLocation( udg_tempPoint )
Set tempPoint = (Center of Spawn Bottom Right1 <gen>)
Unit - Create 1 (Unit-type of (Picked unit)) for (Owner of (Picked unit)) at tempPoint facing Default building facing degrees
Custom script: call RemoveLocation( udg_tempPoint )
Unit - Change ownership of (Last created unit) to Player 11 (Dark Green) and Retain color
Unit Group - Add (Last created unit) to UnitsBottomRightInner
Set tempPoint = (Center of Inner Middle Right <gen>)
Unit - Order (Last created unit) to Move To tempPoint
Custom script: call RemoveLocation( udg_tempPoint )
Unit - Remove (Picked unit) from the game
08-29-2005, 05:12 AM#3
drdlord
So where did I mess up? I thought I caught all the memory leaks but I obviously missed some

<rant>why can't blizzard just clean up their own danmed memory leaks </rant>