• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

How??

Status
Not open for further replies.
-_-

Try it yourself.
JASS:
function test1 takes nothing returns nothing
    local unit u = CreateUnit(Player(0), 'hfoo', 0, 0, 0)
    
    call RemoveUnit(u)
    
    set u = null
endfunction
function test2 takes nothing returns nothing
    local unit u = CreateUnit(Player(0), 'hfoo', 0, 0, 0)
    
    call KillUnit(u)
    call RemoveUnit(u)
    
    set u = null
endfunction

globals
    unit u2 = null
endglobals
function test3 takes nothing returns nothing
    call RemoveUnit(u2)
    
    set u2 = CreateUnit(Player(0), 'hfoo', 0, 0, 0)
    call UnitApplyTimedLife(u2, 0, 0.01)
endfunction


function InitTrig_Test takes nothing returns nothing
    call TimerStart(CreateTimer(), 0.011, true, function test1)
endfunction

The first one only suffers very little memory leaks because of the creation of a unit.
There is no known way to go around it.

The second one is increasing the RAM usage massively (compared to the first).

The third one is a bit different because removing the unit before the expiration timer expired is not going to do much so you have to do it with the last unit.
But that one suffers from the same leaks as the first.
 
Status
Not open for further replies.
Back
Top