• 🏆 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! Memory leaks! Lag!

Status
Not open for further replies.
Level 2
Joined
Oct 6, 2008
Messages
8
I saw the memory leaks tutorials and try fixing a spell of mine to understand how to do it, however i did everything that need to remove the leaks and the game still lags after some uses of the spell... help!

There are 2 triggers.

  • Unit - A unit Starts the effect of an ability
  • (Ability being cast) equal to Tsuga
  • Set Casting_Units[32] = (Casting unit)
  • Set Point_Tsuga = (Target point of ability being cast)
  • Unit - Turn collision for Casting_Units[32] Off
  • Unit - Pause Casting_Units[32]
  • Trigger - Turn on Tsuga 2 <gen>
and
  • Time - Every 0.01 seconds of game time
  • No conditions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Casting_Units[32] is alive Equal to True
    • Then - Actions
      • Set Point_Tsuga_Leak = (Position of Casting_Units[32])
      • Set Point_Tsuga_Leak2 = (Point_Tsuga_Leak offset by 50.00 towards (Angle from (Position of Casting_Units[32] to Point_Tsuga) degrees)
      • Unit - Move Casting_Units[32] instantly to Point_Tsuga_Leak2, facing Point_Tsuga
      • Custom script: call RemoveLocation( udg_Point_Tsuga_Leak )
      • Custom script: call RemoveLocation( udg_Point_Tsuga_Leak2)
      • Animation - play Casting_Units[32]'s walk animation
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between (Position of Casting_Units[32]) and Point_Tsuga) Less than or equal to 50.00
        • Then - Actions
          • Unit - Turn collision for Casting_Units[32] On
          • Unit - Create 1 Spells Dummy for (Owner of Casting_Units[32] at Point_Tsuga facing Default building facing degrees
          • Unit - Order (Last created unit) to Human Mountain King - Thunder Clap
          • Unit - Add a 1.00 second generic expiration timer to (Last created unit)
          • Unit - Unpause Casting_Units[32]
          • Selection - Select Casting_Units[32] for (Owner of Casting_Units[32])
          • Animation - Play Casting_Units[32]'s attack animation
          • Custom script call RemoveLocation( udg_Point_Tsuga )
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Do Nothing
      • Else Actions
        • Trigger - Turn off (This Trigger)
I need help, this look perfectly fine for me :p

PS: I searched similar topics to Memory Leaks and i didnt find something simillar to this.
 
Level 9
Joined
Oct 11, 2009
Messages
477
Like GhostThruster said, adjust your periodic time event to a higher value, like 0.03 he said. 0.01 and 0.03 makes a big difference in game performance. If still lags adjust a little more higher. As for the leaks so far I see is the leaks that GhostThruster also saw, no more.
 
Level 2
Joined
Oct 6, 2008
Messages
8
Thanks guys, i owe you a lot :) i saw those leaks in conditions and etc but i tought those didnt leak.
Well, the 0.03 thing i know and i already replaced.
I have 2 questions: (Triggering Unit) leaks less than Casting Unit or just the game perfomance is better? The same thing with the 0.03 thing: leaks less or just better perfomance?

I know this spell is not MUI, and i actually dont care; i will care when i learn jass lol.

Edit: MUCHHHHHHHHHHHHH Better, however the game starts to lag in the 10th spell and stays... still leaking i think (now is triggering unit, not casting unit anymore but the variable name stays the same).

The code now looks like this:
Time - Every 0.03 seconds of game time
No conditions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)

If - Conditions

(Casting_Units[32] is alive Equal to True

Then - Actions

Set Point_Tsuga_Leak = (Position of Casting_Units[32])
Set Point_Tsuga_Leak2 = (Point_Tsuga_Leak offset by 50.00 towards (Angle from Point_Tsuga_Leak to Point_Tsuga) degrees)
Unit - Move Casting_Units[32] instantly to Point_Tsuga_Leak2, facing Point_Tsuga
Custom script: call RemoveLocation( udg_Point_Tsuga_Leak2)
Animation - play Casting_Units[32]'s walk animation
If (All Conditions are True) then do (Then Actions) else do (Else Actions)

If - Conditions

(Distance between Point_Tsuga_Leak and Point_Tsuga) Less than or equal to 50.00

Then - Actions

Custom script: call RemoveLocation( udg_Point_Tsuga_Leak )
Unit - Turn collision for Casting_Units[32] On
Unit - Create 1 Spells Dummy for (Owner of Casting_Units[32] at Point_Tsuga facing Default building facing degrees
Unit - Order (Last created unit) to Human Mountain King - Thunder Clap
Unit - Add a 1.00 second generic expiration timer to (Last created unit)
Unit - Unpause Casting_Units[32]
Selection - Select Casting_Units[32] for (Owner of Casting_Units[32])
Animation - Play Casting_Units[32]'s attack animation
Custom script call RemoveLocation( udg_Point_Tsuga )
Trigger - Turn off (This trigger)

Else - Actions

Custom script: call RemoveLocation( udg_Point_Tsuga_Leak )

Else Actions

Trigger - Turn off (This Trigger)
 
Last edited:
Level 2
Joined
Oct 6, 2008
Messages
8
Yeah, i guessed that was temporarily. I do understand what memory leaks are and what are not, however is always good to ask people with more experience for a better understanding ;D Thanks sephiroth1234, defskull and GhostThruster.
 
Last edited:
Status
Not open for further replies.
Top