Bad memory leak or... ?

JuffoWup

New Member
Reaction score
6
I am working on massive Hero arena and There are few "periodic event" based abilities that check the game heroes with certain Buffs. Now the actual game starts when every player has picked hero, and when this happens there is short period where... I dunno game lags for a short moment. Should I be worried or what ?
 

JuffoWup

New Member
Reaction score
6
Hmm ... Now that u mentioned, When the trigger that checks every second if Heroes ( variable that shows how many heroes are in map ) is equal to (amount of players in game) sets game on, it runs action that removes every hero tavern from map. Could this cause the "laggy" effect ?
 
S

spazard1

Guest
i think you could change the event on this trigger to "unit - A unit sells a unit" that way it wouldn't have to run every second. just keep the condition the same (the one that checks if there are enough heros). as far as the lag goes, i wouldn't worry about it. most maps that involve picking heros and then removing units hesitate a little bit while the trigger is being run. if it only happens once, it shouldn't be a big deal.
 

JuffoWup

New Member
Reaction score
6
It happens only once, but now that were on the subject: How bad mem. leaks "periodic event" causes ? I think I read some other thread that it shouldn't be used often as it can generate sh*tload of trouble. Is this true ?
 

emjlr3

Change can be a good thing
Reaction score
395
you shoudl only run a few triggers at once, like maybe 15 or so tops I'd say

periodic events adds to that, try and make em so they dont run at the same time

such as make one run ever 1 sec, another run every 1.1sec, etc.

thsi will make sure they only ovelap and run at the same time every so often, whic h it hink should reduce any lag created, but since periodic events dont leak, there is no memory lost, the only prob would be with ppl with slow comps who cant handle a bunch of triggers firing all at once

and 1 second of lag once at beggining isnta big deal I dont think, as long as its only once
 

JuffoWup

New Member
Reaction score
6
Thnx alot ! That was a loadoff... My few most beloved custom hero abilities rest on "periodic event"
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
I've seen a couple

Every 0.01 seconds:
Pick every unit in (entire map)
- IF ((Picked unit) has <buff>) equal to true THEN


That's the kind of stuff you shouldn't do.

Other than that... well.
I know of at least one pretty big map that uses several "a unit is attacked" with no problems at all.
 

emjlr3

Change can be a good thing
Reaction score
395
JuffoWup said:
Thnx alot ! That was a loadoff... My few most beloved custom hero abilities rest on "periodic event"

FYI yu don.t have to have these running always, like if an abiltiy lasts 10 seconds, turn on the periodic trigger at the beginnig of the time and turn it off at the end, you dont need to have it always running, and since the abiltiy wont be running always, there should be no problem
 

JuffoWup

New Member
Reaction score
6
Well I got example like this:

One of my abilities drains Hp and when u turn it on it moves the casting unit
into certain unit group. There is periodic event that reduces Hp every second for units in this unit group. Does this cause trouble or am I fine ?
 

emjlr3

Change can be a good thing
Reaction score
395
have a trigger that when teh ability is on, add unit to unit group and start periodic trigger, when effect stop, turn periodic trigger off and remove unit from unit group ( ofcourse is this can be used by more then 1 unit, then you will jsut have to suffer with the trigger on always, if that is the case, make sure it only runs tops at like every .25 or .5 secs)
now as long as you use what is shown in the Memory Leak guides to pick your unit in the unit group and remove them,there should be no memory leak or lag
 

Rad

...
Reaction score
228
Moving the casting unit, picking units from a group, spawning units at un-specified locations (Random/center points of regions) can cause memory leaks. Just yesterday me and Mr Hulk submitted 2 new tutorials for Memory Leaks (Hulks Tutorial).

Post a few sample triggers that you think might be causing them. In code tags, of course... Not to many that it takes up the entire page though :eek:
 

JuffoWup

New Member
Reaction score
6
This is the trigger that causes dmg to my Pipsquek hero when he has unholy armor activated

Code:
Unholy Armor damage
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in UnholyArmor and do (Actions)
            Loop - Actions
                Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - (2.00 + (0.25 x (Real((Level of (Picked unit)))))))
 

Rad

...
Reaction score
228
My memory leak tutorial said:
Groups: These are fairly easy to remove, so long as they do not use waits as well. It was suggested to only use waits in integer loops by a few people higher than me.

Leak:

Code:
Unit Group - Pick every unit in (Units owned by (Player 1)) and do (Unit - Kill (Picked unit))


Fix:

Code:
Unit Group - Pick every unit in (Units owned by (Player 1)) and do (Unit - Kill (Picked unit)) 
Custom Script: call DestroyGroup(GetLastCreatedGroup())

http://www.thehelper.net/forums/showthread.php?t=27242
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top