HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How is this leaking?

03-21-2006, 09:07 PM#1
Captain Griffen
Even after a quite short test, it is taking a relatively long time to close down the map after playing it (~8 seconds after a minute test). However, with only one trigger that could be causing this, I'm a bit confused as to why, since I think it clears up all the leaks:

Trigger:
Camera
Collapse Events
Time - Every 0.20 seconds of game time
Conditions
Collapse Actions
Set TempPoint1 = (Position of Rifleman 0001 <gen>)
Set TempPoint2 = (TempPoint1 offset by 150.00 towards (Facing of Rifleman 0001 <gen>) degrees)
Camera - Lock camera target for Player 1 (Red) to Rifleman 0001 <gen>, offset by (((X of TempPoint2) - (X of TempPoint1)), ((Y of TempPoint2) - (Y of TempPoint1))) using Default rotation
Camera - Set Player 1 (Red)'s camera Distance to target to (Distance to target of Camera <gen>) over 1.00 seconds
Camera - Set Player 1 (Red)'s camera Angle of attack to (Angle of attack of Camera <gen>) over 1.00 seconds
Camera - Set Player 1 (Red)'s camera Roll to (Roll of Camera <gen>) over 1.00 seconds
Camera - Set Player 1 (Red)'s camera Rotation to (Facing of Rifleman 0001 <gen>) over 1.00 seconds
Camera - Set Player 1 (Red)'s camera Height Offset to (Height Offset of Camera <gen>) over 1.00 seconds
Custom script: call RemoveLocation (udg_TempPoint1)
Custom script: call RemoveLocation (udg_TempPoint2)

I can understand if it lagged, but that isn't the problem, it seems to be leaking. Since the trigger is going to be mostly re-written anyway (highly inefficient), I'm asking mainly for future reference, so there isn't much point pointing out improvements besides the leaks.
03-21-2006, 09:27 PM#2
Jacek
Camera - Lock camera target for Player 1 (Red) to Rifleman 0001 <gen>, offset by (((X of TempPoint2) - (X of TempPoint1))...

you are leaking location in Polar Projection... you must give it to point and destroy also
03-21-2006, 10:24 PM#3
Dalten
Not sure about that... the offset takes a Real variable and the point's the offset uses are being destroyed. You sure it's leaking?
03-22-2006, 05:04 AM#4
Jacek
Oh sry!!! I saw offset and thought its polar offset .... ignore my post!!
03-22-2006, 11:55 AM#5
Chuckle_Brother
Collapse JASS:
function OffsetLocation takes location loc, real dx, real dy returns location
    return Location(GetLocationX(loc) + dx, GetLocationY(loc) + dy)
endfunction

Yep, that leaks. Because OffsetLocation returns a location, as can be seen above.
03-22-2006, 12:51 PM#6
Jacek
I am genius! ;]
so to avoid leaks, you need jass to call the function with not dynamically created variable.
03-22-2006, 12:54 PM#7
Chuckle_Brother
Just save it in a variable, like you did with the other values.

Or, as Jacek said, you can use JASS and go straight for the gold with XY coordinates.
03-22-2006, 05:00 PM#8
Captain Griffen
Oh I do love it when Blizzard do really random things like this. Not much of a problem though. Nowhere near as confusing as making GUI not allow you to use orders via variables.
03-22-2006, 07:03 PM#9
Anitarf
Trigger:
Camera - Lock camera target for Player 1 (Red) to Rifleman 0001 <gen>, offset by (((X of TempPoint2) - (X of TempPoint1)), ((Y of TempPoint2) - (Y of TempPoint1))) using Default rotation
This does not leak anything. I don't see anything in that trigger that would leak.
03-23-2006, 03:04 AM#10
Dalten
Quote:
Originally Posted by Chuckle_Brother
Collapse JASS:
function OffsetLocation takes location loc, real dx, real dy returns location
    return Location(GetLocationX(loc) + dx, GetLocationY(loc) + dy)
endfunction

Yep, that leaks. Because OffsetLocation returns a location, as can be seen above.

I could be wrong but I don't think it uses this function. The GUI action calls for a function that would have to return a real not a point, unless i'm not understanding it correctly.
03-23-2006, 01:09 PM#11
Chuckle_Brother
Yeah, I thought was using the offset function. Not camera offset
03-23-2006, 02:29 PM#12
Jacek
I am not a genius? Damn...
03-23-2006, 03:09 PM#13
Vexorian
1) . Make sure it actually leaks. You need a memory monitor like task manager and also windowed mode so you could see the task manager while the game is active.

2) If it seriously leaks, try disabling the trigger and see if it still leaks, something else could be the real cause of the leaks.

3) If the trigger is the real cause , disable each of the functions until you find the one that is causing the leak

--

why are you locking the camera target each 0.2 seconds?
03-23-2006, 04:16 PM#14
Captain Griffen
Quote:
Originally Posted by Vexorian
1) . Make sure it actually leaks. You need a memory monitor like task manager and also windowed mode so you could see the task manager while the game is active.

Massive difference in time for it to close after the game ended between a 10 second game and a minute game. Fairly sure it leaks.

Quote:
2) If it seriously leaks, try disabling the trigger and see if it still leaks, something else could be the real cause of the leaks.

This trigger and melee initialisation were the only triggers.

Quote:
3) If the trigger is the real cause , disable each of the functions until you find the one that is causing the leak

Mute point now, but it was either the setting of the variables (which shouldn't, as I destroyed them), or it was the locking to the offset. Probably the latter.

Quote:
why are you locking the camera target each 0.2 seconds?

Because it was a hastily made test trigger to see if there was any point continuing, and I forgot that there was the offset by unit's rotation. Now no longer does that.

Problem is solved, just wondering why the lock to offset should leak.
03-23-2006, 07:32 PM#15
Vexorian
only explanation is that it leaks natively (error by blizz programmer)