| 08-15-2006, 01:52 PM | #2 |
1. You use the following alot in the code; Custom script: set udg_NextLoc = null Custom script: call RemoveLocation(udg_NextLoc) What your doing is setting the variable to null and then removing the location null. So it removes nothing!!! Swap these around. |
| 08-15-2006, 01:58 PM | #3 |
I think the call set udg_NextLoc = null is pretty much superfluous. You only null local variables because they will leak, but since you are continuously using this global variable, the previous value keeps getting overwritten so it's meaningless to null it. My JASS isn't so hot though, anyone wanna verify my claim? |
| 08-15-2006, 02:27 PM | #4 |
As far as I know, global variables do not need nullification because they are permanently available. Locals need nullification because once exiting the function, you can never use them and so, the place in memory is lost forever. In the case of the globals, you can reuse them. ~Daelin |
| 08-15-2006, 03:17 PM | #5 |
Its possible to set variables to null in GUI, but its not needed. You can null them if you feel like doing so. NOTE: As n13astra pointed out, you are nulling then destroying. Its complicated what nulling really does, unless you know about pointers. Every handle variable has a pointer, (a unit is a handle, a timer is, anything but integer, string, boolean, real and code). And when you set a handle to something. Like: Trigger: set MyUnit = Last created unitIts really making a pointer that points to the last created unit. Thats a pointer explanation. Now when you destroy the variable, you are destroying the thing that the pointer points to. So for example, a timer, if you type: JASS:call DestroyTimer(MyTimer) When you null the variable, you destroy the pointer, so it points to nothing. If you null then destroy, the actual thing it pointing too is lost, you cant destroy it because its not pointing to anything. So destroy then remove the pointer. |
| 08-16-2006, 12:24 AM | #6 |
In any case, the trigger was still leaking (Yes I made sure it was this trigger) for some reason... It'd be okay the first 75 tiems u used it, then the next 30 times it'd begin to slow the comp down, until the music became all shaky and stuff... I'll switch them around.... lets see if that works :D Just tested it. Yes its still leaking (For reasons unknown) and I have no idea why.... is there anyone who can find out why? |
| 08-17-2006, 01:38 AM | #7 |
First read the rules. Then post the current version of the trigger or edit the top post. |
| 08-17-2006, 04:24 AM | #8 |
Firstly, these last 3 lines i have no idea why youve done it like that but I would change it to use events. Trigger: Wait 0.02 seconds
![]() Trigger - Run (This trigger) (checking conditions)
![]() Skip remaining actionsSkip remaining actions does nothing at all where you have put it. Secondly, If youve made those changes i suggested, then this trigger is no longer leaking. So i would look else where because this aint it. |
| 08-17-2006, 06:39 AM | #9 |
Like they said, remove the set to null completely. It's not needed. Also, this might help eliminate more leaking. This code needs another variable stored: Trigger: Set NextLoc = ((Position of PChar[(Integer A)]) offset by 100.00 towards 135.00 degrees)Trigger: Set tempLoc = Position of PChar[Integer A]
![]() Set NextLoc = tempLoc offset by 100.00 towards 135.00 degrees)Then like I said, make sure to remove both locations. |
