HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Possibly memory leaks

08-26-2006, 10:50 PM#1
GosuSheep
can someone please explain these "LEAKS" to me?

picking units and things like that thatll leak the groups

how can i destroy them, and where do they come in



replies are greatly appreciated.
08-26-2006, 10:55 PM#2
Fireeye
How about looking in a Tut?
Click here
08-27-2006, 07:59 AM#3
The)TideHunter(
Basically, when you create a handle (a handle is anything but a integer, real, string, code, boolean, such as a unit, or a destructable, or a multiboard) it stores the handle is memory.
If you dont set that handle to something (a local or global) then destroy it later, that handle will be undestroyable, so your game is always going to be processing that handle, thats more delay/lag to think about.

Example of a leak:

Collapse JASS:
function ThisLeaks takes nothing returns nothing
    local unit u = CreateUnit(...)
    call DoStuffWithUnit(...)
endfunction

Collapse JASS:
function ThisDosentLeak takes nothing returns nothing
    local unit u = CreateUnit(...)
    call DoStuffWithUnit(...)
    call RemoveUnit(u)
    set u = null
endfunction

You must destroy the handle when you'v finished using it!
Thats what a leak is, when you have lost the reference to a handle, so its undestroyable.
08-27-2006, 09:31 AM#4
blu_da_noob
Quote:
Originally Posted by The)TideHunter(
You must destroy the handle when you'v finished using it!

Your example is very bad, as what you are talking about generally doesn't apply to units. The handle hostage leak, yes, but destroying handles no.
08-27-2006, 11:08 AM#5
The)TideHunter(
I just wanted to give a clear idea on what its about.
08-27-2006, 01:10 PM#6
Vexorian
Quote:
Originally Posted by blu_da_noob
Your example is very bad, as what you are talking about generally doesn't apply to units. The handle hostage leak, yes, but destroying handles no.
Of course it applies to units. You can't leave a unit out there if you are not going to use it anymore, the good thing is that dead units get removed automatically.
08-27-2006, 02:53 PM#7
blu_da_noob
It depends on what he was meaning by 'finished using it'. Ofcourse units should be removed should be removed when they no longer need to be in the game (dummies), but the examples he posted could be misleading. It makes it appear as if the creating a unit and not immediately removing and nullifying makes it leak.
08-27-2006, 02:59 PM#8
Wyvernoid
Yeah... in fact you could use anything else, TH.

Quote:
Originally Posted by blu_da_noob
...Ofcourse units should be removed should be removed when they no longer...
should be removed should be removed should be removed should be removed
^^
08-27-2006, 08:09 PM#9
GosuSheep
well, besides that, i really dont know JASS. can that be explained in WE?
08-27-2006, 10:49 PM#10
The)TideHunter(
Sorry if it seemed misleading.
I used a unit because its the first handle that came to mind.