code = null leak ?

Zack1996

Working on a Map
Reaction score
68
The timer example is kinda stupid, since no one uses a timer which doesn't call a function.
But I've heard of some null leaks, just no idea which functions leak.
 

T.s.e

Wish I was old and a little sentimental
Reaction score
133
No, that doesn't leak. You're probably thinking of boolexprs:

[ljass]call GroupEnumUnitsInRange(g, 0, 0, 900., null) // Takes a boolexpr, and leaks if set to null[/ljass]
[ljass]call TimerStart(t,100,false,null) //Takes a code, and does not leak.[/ljass]
 

Xorifelse

I'd love to elaborate about discussions...........
Reaction score
87
The timer example is kinda stupid, since no one uses a timer which doesn't call a function.
But I've heard of some null leaks, just no idea which functions leak.
I'm certainly not stupid, you are by making such ridiculous statements. Running a timer with no callback is from time to time pretty useful. It's a shame you can't see the benefits of it.
 

Trollvottel

never aging title
Reaction score
262
its used by polledwait by the way. null code does not leak however.

pass null it happens to be leaking. Is it true?

yep, you leak the timer which is created by the function ;)
 

Azlier

Old World Ghost
Reaction score
461
>You're using a locally created timer, it's leaking.

You sir are nonsensing.

Something you never want to destroy... it's not a leak.
 

Trollvottel

never aging title
Reaction score
262
>You're using a locally created timer, it's leaking.

You sir are nonsensing.

Something you never want to destroy... it's not a leak.

he can use it for 100 seconds. well he cant use it, since he has no reference to it. but after 100 seconds the timer expires and is inactive. and since there is no reference to it, it IS a leak. When i was new to mapping i didnt know about leaks and so i did not want to destroy all these locations and groups. they were still leaks.
 

chobibo

Level 1 Crypt Lord
Reaction score
48
It's leaking, no references outside the function, hell you can't even reference that with GetExpiredTimer(), the TimerStart() has no code parameter.

It's something he can't destroy, not something he doesn't want to destroy.

EDIT: He can't even re-use the timer created in that function, it just eats memory.
 

Narks

Vastly intelligent whale-like being from the stars
Reaction score
90
irrelevance at its greatest >.>

also I did not know that boolexprs leak :(

So if I've got:

JASS:
call GroupEnumUnitsInRange(g, 0, 0, 900., null)


and I wanted a non-leaking equivalent, what do I do?
 

Azlier

Old World Ghost
Reaction score
461
>EDIT: He can't even re-use the timer created in that function, it just eats memory.

I can. Return nothing for the win :p.

>and I wanted a non-leaking equivalent, what do I do?

Use a boolexpr?
 

eXirrah

New Member
Reaction score
51
Just to clear things out.... I got reference to that timer my trigger looks like this:

JASS:
 function TimerExpires takes nothing returns nothing
    local real r = GetRandomReal(120,240)
    local timer t = GetExpiredTimer()
    //... Actions
    call TimerStart(t,r,false,null)
endfunction

function InitTrig_Timer takes nothing returns nothing
    local timer t = CreateTimer()
    local real r = GetRandomReal(120,240)
    local trigger trg = CreateTrigger()
    call TimerStart(t,r,false,null)
    call TriggerRegisterTimerExpireEvent(trg,t)
    call TriggerAddAction(trg,function TimerExpires)
endfunction
 

Zack1996

Working on a Map
Reaction score
68
I'm certainly not stupid, you are by making such ridiculous statements. Running a timer with no callback is from time to time pretty useful. It's a shame you can't see the benefits of it.
Didn't mean to offend you. Just started JASS a few months ago, so really don't know too much.
However, I fail to see the how it would be helpful. Would appreciate if you could explain :D

PS: I heard someone say something about GroupEnum leaking if you use a local group. Is it true?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top