call RemoveLocation (udg(variable)[number if it is array])
Player number of picked player is a number.but it wasnt number it was player number of picked player
but it wasnt number it was player number of picked player
that's the array for player number of picked player I believe.
- call RemoveLocation(udg_TempPoint[GetConvertedPlayerId(GetEnumPlayer())])
I'm pretty sure that leaks.that's the array for player number of picked player I believe.
- call RemoveLocation(udg_TempPoint[GetConvertedPlayerId(GetEnumPlayer())])
local player p = GetEnumPlayer()
call RemoveLocation(udg_TempPoint[GetPlayerId(p)])
set p = null
*sigh*
Players don't get removed. So it does not matter if you null player handles or not.
And as DSG said, it takes up memory, maybe not so much, but after some time it will begin to lag or at least your fps will go down.
So then I went through the whole code to find the leak and after 1 hour of searching I found the problem. I forgot to null a local player variable in a function that runs each 0.03 second, one single variable.
Players can actually be removed... but atmost 16 leaks is hardly a concern.
I still null them just because I feel like it. However I really should start not doing so.
It does not. If you're lagging you must have screwed up something else.And as DSG said, it takes up memory, maybe not so much, but after some time it will begin to lag or at least your fps will go down.
These never leak. Not even when you don't null it.not even the 4 bytes the memory address pointer takes up.
struct HandleReference
integer references
pointer theunitvar
endstruct
It was. After I nulled that variable my fps stood on 70 all the time even after thousands of knockbacks. So it fixed the problem.aznricepuff said:Obviously nulling a player pointer wasn't your problem
Nope.Eleandor said:It does not. If you're lagging you must have screwed up something else.And as DSG said, it takes up memory, maybe not so much, but after some time it will begin to lag or at least your fps will go down.
scope test initializer Init
globals
timer t = CreateTimer()
endglobals
function lulz takes nothing returns nothing
local timer ti = GetExpiredTimer()
local timer ti2 = GetExpiredTimer()
local timer ti3 = GetExpiredTimer()
local timer ti4 = GetExpiredTimer()
local timer ti5 = GetExpiredTimer()
local timer ti6 = GetExpiredTimer()
local timer ti7 = GetExpiredTimer()
local timer ti8 = GetExpiredTimer()
local timer ti9 = GetExpiredTimer()
local timer ti10 = GetExpiredTimer()
local timer ti11 = GetExpiredTimer()
local timer ti12 = GetExpiredTimer()
local timer ti13 = GetExpiredTimer()
local timer ti14 = GetExpiredTimer()
endfunction
function Init takes nothing returns nothing
call TimerStart(t, 0.01, true, function lulz)
endfunction
endscope
Eleandor, I know what a handle is... A handle is just another name for pointer. And units, destructables, items etc. Are just different kinds of pointers. Just like in c++.
In c++ a pointer is declared like this: someType* someName;
I.e if I have a class called "unit" I would do something like this: unit* someDood = new unit;
In Warcraft it's much simpler.
Your *test code* does not contain player variables. Hence even if your claims are true, your testcode does not represent your problem.Try this code and run it. If your fps isn't reduced or your not experiencing lag after some time, I'll surrender.
You really didn't read my post, did you? Non-nulled locals indeed cause bugs because of what I said. But this bug is irrelevant for player variables.And I've had issues with non-nulled locals before in other spells and systems.
It seems you didn't read my post. Handles aren't pointers. They are an index to an array of structs that in turn contain the real pointer.
Why do you start babbling about c++? Pointers and handles are a different thing.
Your *test code* does not contain player variables. Hence even if your claims are true, your testcode does not represent your problem.
You really didn't read my post, did you? Non-nulled locals indeed cause bugs because of what I said. But this bug is irrelevant for player variables.
In warcraft it's more complex than just pointers, as I've explained.1. Handles are a kind of pointers, but as I said, in Warcraft it's simpler.
It doesn't, it only causes the reference counter bug.2. It wasn't supposed to contain player variables either. It was supposed to show how non-nulling of locals can cause fps reduction..
3. I didn't say those locals I had issues with was player variables.
I see... Not only did you say your lag was caused by not nulling a player variable, but it's also not even the cause of the lag.When I tested it for the first time it didn't take long before my fps got reduced from 70 to 50. So then I went through the whole code to find the leak and after 1 hour of searching I found the problem. I forgot to null a local player variable in a function that runs each 0.03 second, one single variable
That issue is not the one I'm talking about.I see... Not only did you say your lag was caused by not nulling a player variable, but it's also not even the cause of the lag.
Your testcode was a response to me saying un-nulled players are not the cause, so the testcode is irrelevant to your claim that players need to be nulled.