HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Made a TD (Memory leak)

05-24-2006, 07:52 AM#1
Siphonized
I made a huge TD with loads of triggers, and I was wondering if anyone knows which common memory leaks exist in TDs?

I've already fixed "Unit enters region" memory leak.
05-24-2006, 10:06 AM#2
PitzerMike
Well, like every other map, a TD will suffer mostly from unit group and location leaks - due to the use of blizzard.j functions.

Make sure you're setting bj_wantDestroyGroup to true (where necessary) before PickEveryUnit... commands.
05-24-2006, 12:26 PM#3
iNfraNe
just out of curiousity, wtf is the
"Unit enters region" memory leak.
05-24-2006, 03:33 PM#4
The)TideHunter(
I think is leaks a region(rect), not sure, iv heard something about it before but not all knowing of it lol
05-24-2006, 04:21 PM#5
PitzerMike
Well, setting the event up leaks a jass region (that is created from the rect you specify). But this won't increase the memory over time, just at initialization, and you wouldn't have sooo many region events that it's really an issue.
05-24-2006, 10:36 PM#6
Soulprovider
Although this is not a leak this is a glitch I've found in my TD so far and thus you need to either work around it or remove it.

Don't put any Active spells that Increase speed or heal with your units unless you set up triggers to keep the units going on the path they are supposed to go on.

It has been my experience as a newb(New maker) that they cast these abillities and then head right back to the starting point or just stand in one location.

You can work around this with triggers however I feel its not worth it unless you want the effect.
05-28-2006, 11:36 PM#7
Siphonized
Quote:
Originally Posted by PitzerMike
Well, like every other map, a TD will suffer mostly from unit group and location leaks - due to the use of blizzard.j functions.

Make sure you're setting bj_wantDestroyGroup to true (where necessary) before PickEveryUnit... commands.

Any way to do this in GUI?
05-29-2006, 04:28 AM#8
PipeDream
Yes and no.
Trigger:
Custom Script - set bj_wantDestroyGroup = true
05-29-2006, 07:50 AM#9
Siphonized
Is that a variable or what?
05-29-2006, 12:03 PM#10
Jacek
yes it is a variable... hmm topic is TD, most likely you are leaking location using Center of Region every time, to avoid this you must make variable of type location and do this everytime you use Center or region:

set temp_loc = Center of SPAWNING POINT
Unit - Order Footman to Move to temp_loc
Custom script("call RemoveLocation(udg_temp_loc)


of course if your variable is called temp_loc
05-29-2006, 03:59 PM#11
Soultaker
Quote:
Originally Posted by Jacek
yes it is a variable... hmm topic is TD, most likely you are leaking location using Center of Region every time, to avoid this you must make variable of type location and do this everytime you use Center or region:

set temp_loc = Center of SPAWNING POINT
Unit - Order Footman to Move to temp_loc
Custom script("call RemoveLocation(udg_temp_loc)


of course if your variable is called temp_loc

Yeahs, that's a very important thing, because it will leak for every mob spawned (40 levels * 200 mobs?). It's the same if you use this:

Trigger:
Unit - Create ? Unittype for Player ? (??) at (Random point in (Playable map area)) facing Default building facing degrees

Then the random point will leak too.

Sadly Jacek, you wrote it wrong, so it will give an error if you copy it into WE. You wrote " infront of the call.

One more thing Siphonized, I don't know how you are checking if all the units are dead atm, but the best way for you would be this I beleive:

Trigger:
Spawn Units
Events
Conditions
Collapse Actions
Set temp_loc = (Center of (Playable map area))
Unit - Create 20 Frog for Neutral Hostile at temp_loc facing Default building facing degrees
Custom script: call RemoveLocation(udg_temp_loc)
Set Number_Of_Units = 20

Trigger:
Unit dies
Collapse Events
Unit - A unit owned by Neutral Hostile Dies
Conditions
Collapse Actions
Set Number_Of_Units = (Number_Of_Units - 1)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Number_Of_Units Equal to 0
Collapse Then - Actions
(Insert something here...)
Else - Actions

Well, I hope I helped :)

- Soultaker
05-29-2006, 07:12 PM#12
Siphonized
(Insert something here...) doesn't help me very much as I am very foreign to custom scripts.

:)
05-29-2006, 07:45 PM#13
Soultaker
Quote:
Originally Posted by Siphonized
(Insert something here...) doesn't help me very much as I am very foreign to custom scripts.

:)

=)

Well, that means the you run the next level. Like summon the next level:

Trigger:
Next Level
Events
Conditions
Collapse Actions
Collapse For each (Integer A) from 1 to 25, do (Actions)
Collapse Loop - Actions
Set temp_loc = (Center of Start Zone <gen>)
Unit - Create 1 Frog for Neutral Hostile at temp_loc facing Default building facing degrees
Custom script: call RemoveLocation(udg_temp_loc)
Set temp_loc = (Center of End Zone <gen>)
Unit - Order (Last created unit) to Move To temp_loc
Custom script: call RemoveLocation(udg_temp_loc)

- Soultaker
05-29-2006, 07:54 PM#14
Anopob
Wait, so you stop the variable so that the variable works on ALL regions?

EDIT: @2nd trigger of Soultaker: How do you get number_of_units = number_of_units -1!?!??! (I can't get the -1 part...)
05-29-2006, 08:46 PM#15
PipeDream
You learn JASS and type it in :) Or use the arithmetic - minus stuff in the GUI. Make sure you've got that global already there as an integer or real or whatever it's supposed to be.