• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Help in Memory Leaks!

Status
Not open for further replies.
Level 6
Joined
Jul 25, 2010
Messages
136
When I turn on creep spawning it slows down my computer. Plzzz help
What is wrong about my trigger?

  • Events
    • Time - Every 30.00 seconds of game time
  • Conditions
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (War Factory 0157 <gen> is dead) Equal to True
      • Then - Actions
        • Set Spawns[1] = (Center of Reg1 <gen>)
        • Unit - Create 2 Priest (spawned-strong) for Player 11 (Dark Green) at Spawns[1] facing Default building facing degrees
        • Custom script: call RemoveLocation (udg_Spawns[1])
      • Else - Actions
        • Set Spawns[1] = (Center of Reg1 <gen>)
        • Unit - Create 2 Priest (spawned) for Player 11 (Dark Green) at Spawns[1] facing Default building facing degrees
        • Custom script: call RemoveLocation (udg_Spawns[1])
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Barracks 0161 <gen> is dead) Equal to True
      • Then - Actions
        • Set Spawns[1] = (Center of Reg1 <gen>)
        • Unit - Create Number_Spwn[1] Heaven Warrior (spawned-strong) for Player 11 (Dark Green) at Spawns[1] facing Default building facing degrees
        • Custom script: call RemoveLocation (udg_Spawns[1])
      • Else - Actions
        • Set Spawns[1] = (Center of Reg1 <gen>)
        • Unit - Create Number_Spwn[1] Heaven Warrior (spawned) for Player 11 (Dark Green) at Spawns[1] facing Default building facing degrees
        • Custom script: call RemoveLocation (udg_Spawns[1])
    • Wait 1.00 game-time seconds
    • Set move_unit[1] = (Units in Reg1 <gen> owned by Player 11 (Dark Green))
    • Set Movements[1] = (Center of Movement Right <gen>)
    • Unit Group - Order move_unit[1] to Attack-Move To Movements[1]
    • Custom script: call DestroyGroup (udg_move_unit[1])
    • Custom script: call RemoveLocation (udg_Movements[1])

plzzz help

You can just download the map and see it for your self!
Also check if there are errors connecting to spawning
Click the attachment
 

Attachments

  • DYC-GW V2.2.w3x
    2.1 MB · Views: 65
Level 8
Joined
Dec 12, 2010
Messages
280
If your getting slow down on your map due to creep spawning its likely because the population isn't kept in check. Creep spamming causes more lag than most memory leaks could every cause. Keep the creep population in check by adding a condition like this.

(Number of units in (Units in (Playable map area) owned by Player 11 (Dark Green))) Less than 20

Add this at the top of this trigger so the trigger would only fire if the poulation drops or is less than the amount in the condition.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
CRAB.... Hes using arrays... move_unit is a group array and Movements is a location array. God knows why though as it is far more efficent to use separate variables (as you are not getting any benifit from the functionality an index provides).

The low performance is probably once off due to it having to load the units (thus pause until the data is loaded). Try waiting another 30 seconds to see if it skips more frames.
 
Level 3
Joined
Dec 31, 2003
Messages
42
I think your problem is this part:
  • Set move_unit[1] = (Units in Reg1 <gen> owned by Player 11 (Dark Green))
  • Set Movements[1] = (Center of Movement Right <gen>)
  • Unit Group - Order move_unit[1] to Attack-Move To Movements[1]
  • Custom script: call DestroyGroup (udg_move_unit[1])
  • Custom script: call RemoveLocation (udg_Movements[1])
I don't know how big the region Reg1 is, but if it is big this would cause mass orders to be sent to all units in the area. This tends to cause units to freeze more or less.

Here's how I would do the trigger, by adding each unit created to the group rather trying to find them in Reg1:

  • Events
    • Time - Every 30.00 seconds of game time
  • Conditions
  • Actions
    • Set Spawns[1] = (Center of Reg1 <gen>)
    • -------- create the unit group --------
    • Custom script: set udg_move_unit[1] = CreateGroup()
    • -------- set what type of unit to spawn (new variable: TempSpawnType) --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (War Factory 0157 <gen> is dead) Equal to True
      • Then - Actions
        • Set TempSpawnType = Priest (spawned-strong)
      • Else - Actions
        • Set TempSpawnType = Priest (spawned)
    • -------- spawn the units and add them to our group --------
    • Unit - Create 1 TempSpawnType for Player 11 (Dark Green) at Spawns[1] facing Default building facing degrees
    • Unit Group - Add (Last created unit) to move_unit[1]
    • Unit - Create 1 TempSpawnType for Player 11 (Dark Green) at Spawns[1] facing Default building facing degrees
    • Unit Group - Add (Last created unit) to move_unit[1]
    • -------- again, see what type of unit to spawn --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Barracks 0161 <gen> is dead) Equal to True
      • Then - Actions
        • Set TempSpawnType = Heaven Warrior (spawned-strong)
      • Else - Actions
        • Set TempSpawnType = Heaven Warrior (spawned)
    • -------- we use a loop to create our units and some JASS because it's much more efficient --------
    • For each (Integer A) from 1 to Number_Spwn[1], do (Actions)
      • Loop - Actions
        • -------- we create a unit for Player 11 (player 10 is player 11 in jass) and store in the Last created unit variable --------
        • Custom script: set bj_lastCreatedUnit = CreateUnitAtLoc(Player(10), udg_TempSpawnType, udg_Spawns[1])
        • -------- we add the new unit to our group --------
        • Unit Group - Add (Last created unit) to move_unit[1]
    • -------- order the attack --------
    • Set move_unit[1] = (Units in Reg1 <gen> owned by Player 11 (Dark Green))
    • Set Movements[1] = (Center of Movement Right <gen>)
    • Unit Group - Order move_unit[1] to Attack-Move To Movements[1]
    • -------- clean up --------
    • Custom script: call RemoveLocation(udg_Spawns[1])
    • Custom script: call DestroyGroup(udg_move_unit[1])
    • Custom script: call RemoveLocation(udg_Movements[1])
Some comments:

- Used a variable for the type of unit spawned in order to make the code less clunky
- We don't need to set the location and remove it over and over because it'll always be the same. Instead, set the location in the beginning and destroy it when it isn't needed anymore.
- I'm not sure why you had a game-time wait in there so I removed it.
- I haven't actually tested the code so I might've made spelling mistakes or something similar

hope it helps... Otherwise, I think your problem lies somewhere else
 
Level 6
Joined
Jul 25, 2010
Messages
136
Error Hang

I think your problem is this part:
  • Set move_unit[1] = (Units in Reg1 <gen> owned by Player 11 (Dark Green))
  • Set Movements[1] = (Center of Movement Right <gen>)
  • Unit Group - Order move_unit[1] to Attack-Move To Movements[1]
  • Custom script: call DestroyGroup (udg_move_unit[1])
  • Custom script: call RemoveLocation (udg_Movements[1])
I don't know how big the region Reg1 is, but if it is big this would cause mass orders to be sent to all units in the area. This tends to cause units to freeze more or less.

Here's how I would do the trigger, by adding each unit created to the group rather trying to find them in Reg1:

  • Events
    • Time - Every 30.00 seconds of game time
  • Conditions
  • Actions
    • Set Spawns[1] = (Center of Reg1 <gen>)
    • -------- create the unit group --------
    • Custom script: set udg_move_unit[1] = CreateGroup()
    • -------- set what type of unit to spawn (new variable: TempSpawnType) --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (War Factory 0157 <gen> is dead) Equal to True
      • Then - Actions
        • Set TempSpawnType = Priest (spawned-strong)
      • Else - Actions
        • Set TempSpawnType = Priest (spawned)
    • -------- spawn the units and add them to our group --------
    • Unit - Create 1 TempSpawnType for Player 11 (Dark Green) at Spawns[1] facing Default building facing degrees
    • Unit Group - Add (Last created unit) to move_unit[1]
    • Unit - Create 1 TempSpawnType for Player 11 (Dark Green) at Spawns[1] facing Default building facing degrees
    • Unit Group - Add (Last created unit) to move_unit[1]
    • -------- again, see what type of unit to spawn --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Barracks 0161 <gen> is dead) Equal to True
      • Then - Actions
        • Set TempSpawnType = Heaven Warrior (spawned-strong)
      • Else - Actions
        • Set TempSpawnType = Heaven Warrior (spawned)
    • -------- we use a loop to create our units and some JASS because it's much more efficient --------
    • For each (Integer A) from 1 to Number_Spwn[1], do (Actions)
      • Loop - Actions
        • -------- we create a unit for Player 11 (player 10 is player 11 in jass) and store in the Last created unit variable --------
        • Custom script: set bj_lastCreatedUnit = CreateUnitAtLoc(Player(10), udg_TempSpawnType, udg_Spawns[1])
        • -------- we add the new unit to our group --------
        • Unit Group - Add (Last created unit) to move_unit[1]
    • -------- order the attack --------
    • Set move_unit[1] = (Units in Reg1 <gen> owned by Player 11 (Dark Green))
    • Set Movements[1] = (Center of Movement Right <gen>)
    • Unit Group - Order move_unit[1] to Attack-Move To Movements[1]
    • -------- clean up --------
    • Custom script: call RemoveLocation(udg_Spawns[1])
    • Custom script: call DestroyGroup(udg_move_unit[1])
    • Custom script: call RemoveLocation(udg_Movements[1])
Some comments:

- Used a variable for the type of unit spawned in order to make the code less clunky
- We don't need to set the location and remove it over and over because it'll always be the same. Instead, set the location in the beginning and destroy it when it isn't needed anymore.
- I'm not sure why you had a game-time wait in there so I removed it.
- I haven't actually tested the code so I might've made spelling mistakes or something similar

hope it helps... Otherwise, I think your problem lies somewhere else

Reg 1 is not that big so I dont think it causes the hang
Do you know a solution for this error:
This application has encountered a critical error:

Not enough storage is available to process this command.

Program: d:\program files\world of warcraft\war3.exe
Object: CUnitListNode (.?AUCUnitListNode@@)

Thats the error I am talking about that is generated after below 50 mins

Edit: Does mass order cause hang or lag or leak?

Thanks Aquilla for the post
 
Level 8
Joined
Dec 12, 2010
Messages
280
I played this map for 35 minutes and never experienced any lag. (poor game performance) This map is like most AOS type maps with units being ordered. Shouldn't be a problem. I suggest you remove the rays of light from the map as that would free up some memory for your memory starved computer. That alone could make all the difference.

Is that red fog? If so thats another memory hog. Wasn't a problem for my comp but I got 4 gb of memory.

Remove the visuals and your problems should be solved.

Any animations use cpu power and memory. And when they're global like fog that can be a real show stopper.
 
Level 6
Joined
Jul 25, 2010
Messages
136
Oh thanks for all the replies case solved!
I have freed a lot of memory. I thought it was in the Spawning but it was because of the pick every units near the spawning region. It picks all of the units that spawned but the point and group is not destroyed so I fixed it. thanks a lot to all! Just wait for the release of the game. :)
JGGD

Edit: And also the AI thing I fixed it
 
Status
Not open for further replies.
Top