Avoid Memories leak

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: Avoid Memories leak

Post by Aero »

wtf?

You cannot null an integer or a real.

Integers, reals and strings do not leak.

Only thing you need to worry about is handles.
Local handle variables always need to be nulled if you declare a handle into them. (This is true except for under special circumstances). Some handles even need to be destroyed.

But that's it--don't touch integers or reals.
initialD
Some Honorary Title
Posts: 1713
Joined: June 8th, 2007, 5:08 am
Title: Angry Bird

Re: Avoid Memories leak

Post by initialD »

I have just tested them. You are right they cant be nulled.
I have no idea how, if unused integers are greater than an X amount, the game will causes a lot of lags and disconnecting.
I was just trying to solve that problem.
W/e, I have solved that problem by using too much integers in a condition situation.
Examples: if integerZ>6 then

If this kind of conditions are greater than an X amount, the game will crashes.
I have no idea.
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: Avoid Memories leak

Post by Aero »

initiald wrote:I have just tested them. You are right they cant be nulled.
I have no idea how, if unused integers are greater than an X amount, the game will causes a lot of lags and disconnecting.
That's not true at all.
Doesn't matter what the value of an integer is, it's not laggy and does not d/c.

The problem is elsewhere.
User avatar
weirdone2
Forum Staff
Posts: 926
Joined: June 3rd, 2007, 8:03 pm

Re: Avoid Memories leak

Post by weirdone2 »

You could be screwing up in a loop perhaps.
initialD
Some Honorary Title
Posts: 1713
Joined: June 8th, 2007, 5:08 am
Title: Angry Bird

Re: Avoid Memories leak

Post by initialD »

hmm, then it would be loops.
How could loops causes lags and such? How to avoid it?
User avatar
weirdone2
Forum Staff
Posts: 926
Joined: June 3rd, 2007, 8:03 pm

Re: Avoid Memories leak

Post by weirdone2 »

well if you make the loop loop too much is a grand way to cause lag you know looking at something 50000 times just cuz ur loop is mean is never fun. To fix this just try to make sure your loop doesn't have to loop too much and make sure you don't mess up and have a never ending loop.:)
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: Avoid Memories leak

Post by Aero »

Infinite loops will cause a lag spike until the game reaches the stack limit in which the loop will stop and the function will just exit.
initialD
Some Honorary Title
Posts: 1713
Joined: June 8th, 2007, 5:08 am
Title: Angry Bird

Re: Avoid Memories leak

Post by initialD »

Let's see if this is true.

set d=0
loop
if SubString(0,d)=="-call" then
call Function (d)
endif
set d=d+1
exitwhen d>5
endloop

I think it's because when the conditions is true, it takes the integer d to the other function.
Since d has been brought to another place, it is not exits in the loop anymore and thus causes an infinite loop. As d would never be >5.
I am not sure.
But what causes server split it some sort of triggers just like above.
User avatar
weirdone2
Forum Staff
Posts: 926
Joined: June 3rd, 2007, 8:03 pm

Re: Avoid Memories leak

Post by weirdone2 »

d will be greater then 5 in 6 runs of the loop as for what the function Function() does who knows, guess only you. :P
initialD
Some Honorary Title
Posts: 1713
Joined: June 8th, 2007, 5:08 am
Title: Angry Bird

Re: Avoid Memories leak

Post by initialD »

Aero, please take a look if these codes still leaks. thanks

Code: Select all

call PingMinimapLocForForceEx(GetForceOfPlayer(ConvertedPlayer(GetForLoopIndexA())),GetUnitLoc(udg_heroes[GetForLoopIndexB()]),2.00,bj_MINIMAPPINGSTYLE_SIMPLE,(udg_cred[GetForLoopIndexB()]/2.56),(udg_cgreen[GetForLoopIndexB()]/2.56),(udg_cblue[GetForLoopIndexB()]/2.56))
call DestroyForce(GetForceOfPlayer(ConvertedPlayer(GetForLoopIndexA())))
call RemoveLocation(GetUnitLoc(udg_heroes[GetForLoopIndexB()]))