HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

memory leak?

11-05-2004, 10:17 AM#1
311
I keep hearing about triggers that leak and cause the map to lag, and most have to do with unit groups, well I think I only have 1 trigger that does unit groups often, so was wondering does this leak, and if it does how do I fix it

E: Time - Every (Random real number between 0.60 and 4.60) seconds of game time

A: Unit - Create (Random integer number between 1 and 3) Spider for Player 12 (Brown) at (Center of spawn_points[(Random integer number between 1 and 16)]) facing Default building facing degrees

A: Unit Group - Pick every unit in (Last created unit group) and do (Unit - Order (Picked unit) to Attack (Random unit from (Units in (Entire map) matching (((Matching unit) belongs to an enemy of Player 12 (Brown)) Equal to True))))


the trigger generates 1-3units at a random location every 1-5seconds sends those units to the player
11-05-2004, 01:13 PM#2
Guest
Memory leaks will probably happen only with JASS hand-made triggers. If you use worldedit triggers you should never have any problems. Your trigger looks ok to me.

Salutions®
11-05-2004, 01:34 PM#3
AFB-DieHard
http://www.wc3campaigns.com/showthread.php?t=55022
11-06-2004, 03:55 AM#4
311
Event: Time - Every (Random real number between 1.20 and 6.00) seconds of game time

Action: Set TempPoint = (Center of spawn_points[(Random integer number between 1 and 16)])

Action: Unit - Create (Random integer number between 1 and 3) Spider 1 for Player 12 (Brown) at (TempPoint offset by (0.00, 0.00)) facing Default building facing degrees


Action: Custom script: call RemoveLocation( udg_TempPoint )

Action: Custom script: set bj_wantDestroyGroup = true

Action: Unit Group - Pick every unit in (Last created unit group) and do (Unit - Order (Picked unit) to Attack (Random unit from maingroup))




So this has no leaks now right?, btw is there anyway to test is theres leaks? Also leaks only come in the actions part right, not conditons or events?
11-06-2004, 12:47 PM#5
Anitarf
(TempPoint offset by (0.00, 0.00)) This is still a memory leak. Sure, you have the TempPoint variable, but then, you offset it by some number (doesn't matter that it's 0,0), so you get another point object, and that point object isn't set to any variable, so you loose track of it and can't prevent the leak. Just use (TempPoint) instead of (TempPoint offset by (0.00, 0.00)).

I don't know about "set bj_wantDestroyGroup = true". I don't use it, because there has been somewhere at sometime some debate if it works or not. I don't know if it does or not, so I just use for unit-groups the same method I use for point objects.