• 🏆 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!

Things That Leak

Level 12
Joined
Aug 20, 2007
Messages
866
Oh

So I suppose if it a massive trigger that runs periodically with the remove unit function (like a flurry of arrows or something) it would cause some bad lag after a while?
 
Level 12
Joined
Aug 20, 2007
Messages
866
RemoveDestructable()

If the removeunit leaks, would this one??? or is the destructs too small to leak?
 
Level 19
Joined
Sep 4, 2007
Messages
2,826
Does this trigger leak? The game becomes laggy after I've filled the map with walls in 180 x 180 playable map area.
  • Create Unit Walls
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Visibility - Disable fog of war
      • Visibility - Disable black mask
      • Set BlockValue = 128.00
      • For each (Integer A) from 1 to 180, do (Actions)
        • Loop - Actions
          • For each (Integer B) from 1 to 180, do (Actions)
            • Loop - Actions
              • Set TempPoint = (Center of Region 000 <gen>)
              • Unit - Create 1 Walls for Neutral Passive at (TempPoint offset by ((BlockValue x X), (BlockValue x Y))) facing 269.00 degrees
              • Custom script: call RemoveLocation(udg_TempPoint)
              • Set X = (X + 1.00)
          • Wait 0.01 seconds
          • Set Y = (Y - 1.00)
          • Set X = 0.00
 
Level 19
Joined
Sep 4, 2007
Messages
2,826
You mean like this?
  • Create Unit Walls
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Visibility - Disable fog of war
      • Visibility - Disable black mask
      • Set BlockValue = 128.00
      • For each (Integer A) from 1 to 180, do (Actions)
        • Loop - Actions
          • For each (Integer B) from 1 to 180, do (Actions)
            • Loop - Actions
              • Set TempPoint = (Center of Region 000 <gen>)
              • Set TempPoint2 = (TempPoint offset by ((BlockValue x X), (BlockValue x Y)))
              • Unit - Create 1 Walls for Neutral Passive at TempPoint2 facing 269.00 degrees
              • Custom script: call RemoveLocation(udg_TempPoint)
              • Custom script: call RemoveLocation(udg_TempPoint2)
              • Set X = (X + 1.00)
          • Wait 0.01 seconds
          • Set Y = (Y - 1.00)
          • Set X = 0.00
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
Some Enum functions don't create a group (the ones which take code as a parameter), they just execute that code func for each something in that group (not group as in variable).

P.S. Actually, no Enum function creates group, that was just the figure of speech, they just add things to groups (unit Enum funcs)-

P.S.2. Item groups?? Haha! That's rich! No.
 
Level 4
Joined
Mar 15, 2008
Messages
71
...sorry I'm kind of a newb with custom scripts and jass and all that stuff...
when I type in,for example, call destroygroup(udg_Unit_Group)-- > unit_group is a variable with array ( Unit_Group[9923] )
does that destroy all the arrays of that variable and is there a way to specify that array of an variable you want to destroy...
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
...sorry I'm kind of a newb with custom scripts and jass and all that stuff...
when I type in,for example, call destroygroup(udg_Unit_Group)-- > unit_group is a variable with array ( Unit_Group[9923] )
does that destroy all the arrays of that variable and is there a way to specify that array of an variable you want to destroy...

First of all, destroygroup is not same as DestroyGroup, JASS is case sensitive, so you should be careful (otherwise you'll get an error telling you that function doesn't exist). Same for variables unit_group and Unit_Group are two different things.

You can't destroy all the whole array like that, the system will ask you to specify the index. You can do it like this: call DestroyGroup(udg_Unit_Group[<index here>]) (this is without <>)
 
Level 7
Joined
Mar 24, 2008
Messages
184
I, like many others, have a newb and weird question...Do events leak? I mean, i have a Trigger which keeps getting new events when an hero attacks a unit, so there is an event for each unit the hero attacks. Is it possible that a trigger with a big number of events may slow the game and waste memory (in this case, if i got the definition of leak, the fact the unit a event was refered to dies could be considered a leak?)
Also while we're at it, is there a way to remove events from a trigger?
 
Level 12
Joined
Aug 20, 2007
Messages
866
I have been curious about that as well, and never got a straight answer

I believe there is some kind of leak, the way I get rid of it is simply by refreshing the events every once in a while by destroying the current trigger object, and then setting a fresh trigger to it, and then adding all the events I need to keep
 
Level 11
Joined
Aug 25, 2006
Messages
971
Correct, setting an event causes memory to be allocated for that event. If you do not unallocate it, it could become quite wasteful.
 
Level 5
Joined
Oct 27, 2007
Messages
158
How should we go about un-allocation???


You don't allocate or deallocate memory yourself. The game allocates memory for objects you create in triggers. The only thing you need to do is destroy the object, so the allocated memory is freed. However you also need to null any local references to destroyed objects because otherwise that specific handle index can't be recycled.
 
Level 5
Joined
Oct 27, 2007
Messages
158
Ok, I was more specifically asking how to get rid of event leaks

Would be REALLY REALLY nice to know


You already got an answer. Make sure that you don't forget to destroy/remove objects and null their local references that were created during an event.

If you use certain things a lot and MUI is not an issue then make globals. If you don't need certain things more than once or rarely, destroy/remove the objects and null references. If you don't reuse stuff or use it rarely then it's just sitting in memory most of the time doing nothing.
 
Level 12
Joined
Aug 20, 2007
Messages
866
...your not understanding my question

EVENT LEAKS

I know all I need to know about regular leaks, EVENT LEAKS, are a question, because there is no event variable, nor any function to remove them

I wanted to know if anybody here has figured out an effective way to remove event leaks for systems like damage detection systems

I had already offered the way I would do it, but I don't know if it works, or if there is a better way
 
Level 6
Joined
Nov 28, 2007
Messages
203
The problem is that there is no DestroyEvent() function.

However, I do remember seeing a "reset trigger" function somewhere...
Code:
call DestroyTrigger(gg_trg_YourTrigger)
call DestroyTrigger(GetTriggeringTrigger()) (for destroying "this" trigger)
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
Code:
call DestroyTrigger(gg_trg_YourTrigger)
call DestroyTrigger(GetTriggeringTrigger()) (for destroying "this" trigger)

lul nub

And

Its not possible to destroy events in my knowladge
Creating events dont return anything
there is no triggerevent type of variable
and there is no DestroyEvent function
 
Level 5
Joined
Oct 27, 2007
Messages
158
I have been curious about that as well, and never got a straight answer

I believe there is some kind of leak, the way I get rid of it is simply by refreshing the events every once in a while by destroying the current trigger object, and then setting a fresh trigger to it, and then adding all the events I need to keep


I missed this message you posted, hence my previous answer.
How did you found out that the event is causing leaks?

If a certain event is consuming a lot of memory over time then you'll notice it the moment you destroy the causing trigger, by looking at the memory usage before and after. An event is a part of a trigger so the used up memory should be freed once the trigger is destroyed. Is this the case?

Is your map running noticeable faster when you destroy and recreate the trigger?

I personally think that it's unlikely that events leak, otherwise more people would've noticed. It's much more likely that the trigger is using natives that cause leaks, or possibly the event handler is causing leaks under certain unique conditions or events. Maybe you can post the culprit?
 
Level 12
Joined
Aug 20, 2007
Messages
866
Well, actually its a bit of an odd situation atm

For the most part I had assumed it to be common knowledge about the event leaks, because PurplePoot has mentioned it a few times somewhere around here (I believe in one of my spells that needed damage detection) and a dew other spells that I have come across that needed damage detection

The only reason I can think of that it would be a problem to have event leaks would be a damage detection system


Anyway, I personnally had a problem, because I had a massive map which used auto-casting triggers, so I really couldn't tell what was causing all the lag (could've even been another system I had ><)

Now that I think about it, I could make a quick test map, that registers a bunch of events to a trigger in a loop, and then I could check to see if there was any lag

Then, I will add a little refresher system, and check the lag

I will post both of the maps up in a thread in the JASS section
 
Level 7
Joined
Mar 24, 2008
Messages
184
i have a map with a trigger that gets a event for every unit i attack with a certain hero, another hero has an ability with some 0.27 secs waits and i've noticed that if i use that ability at the start of the map, and after i've attacked some units with the other hero, then it takes slightly more time to execute the ability, since everything else in the map is leakless (at least i think so) event leaks could be the only explaination.

While we're at it i have 2 questions:

1)if i want to reset a global (not local) trigger by destroying it and initializing it again, do i have to destroy conditions and actions aswell or is it enough to use DestroyTrigger and then call the InitTrig function again in order to avoid leaks?

2) About floating texts leaks, is it enough to set the lifespan of a floating text or do i have to destroy it to make it not leak?
 
Last edited:
Level 12
Joined
Mar 16, 2006
Messages
992
Can someone help me? I have this one major leak that I'm not sure how to fix.

It's driving me crazy.

Every night before I go to sleep I can hear my shower head dripping. Please, tell me how to fix the leak!
 
Level 12
Joined
Aug 20, 2007
Messages
866
Yeah, it would be pretty cool if somebody made a whole sound tutorial all together, there are alot of things you need to know about 3D sounds in JASS
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
I found that if you destroy sounds, they will NEVER play again in the map o.o

that is pretty useless if you are using spells, please add that to the main page ^^

I create from same label and kill when done each time I need to play that sound (it needs to get played repeatly)
 
Level 12
Joined
Aug 20, 2007
Messages
866
Errr whats the code you use to play the label?
What exactly is the label? (Sound variable, filename, or...?)
How could I use that code to play the sound in 3D as a local variable, so I can have it play the way it is played when a unit attacks and what not???
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
Shit I can't understand what are you talking about...

I wanna know how can I remove sounds leak without been unable to do the sound again!

Sounds don't leak if you do not locally create them. You can use a global one and just use StartSound or something?

If you create a local one, you can destroy it and you will still be able to play that sound, you just have to create it again.

Or I'm wrong?
 
Top