destroying a terraindeformation

Narks

Vastly intelligent whale-like being from the stars
How do I destroy a terraindeformation handle? (as in, remove the handle, so no leaking)

Unrelated note: do I need to null unit handles? (I've heard that they leak anyway)
 

tooltiperror

Super Moderator
Staff member
The only function in common.j that takes a [LJASS]terraindeformation[/LJASS] as an argument, to my knowledge, is [LJASS]native TerrainDeformStop[/LJASS]. I'll test if it leaks and edit this post ...

Anything that extends handle needs to be nulled, including widgets, and therefore units.
 

Romek

Super Moderator
Staff member
You need to null any handle that could be destroyed. This excludes players, most triggers, and most boolexprs. Units won't directly be removed through triggers, but will die and decay eventually.
Also, you usually don't need to null heroes (unless they're going to be physically removed) or any dummy units that are recycled, since they don't decay and won't be removed. Though you're better of nulling every unit rather than checking if it's a hero or not. :p

If you don't know what not to null, you're better of nulling everything that extends handle.
 
Anyway, [ljass]TerrainDeformStop[/ljass] does remove the leak.
It does not. Or why do the ids climb up?

JASS:
function Trig_Nahkampf_Initialisierung_Actions takes nothing returns nothing
    local terraindeformation t = TerrainDeformCrater(0, 0, 64, 100, 1000, true)

    call TerrainDeformStop(t, 100)

    call BJDebugMsg(I2S(GetHandleId(t)))

    set t = null
endfunction

//===========================================================================
function InitTrig_Nahkampf_Initialisierung takes nothing returns nothing
    set gg_trg_Nahkampf_Initialisierung = CreateTrigger(  )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Nahkampf_Initialisierung, Player(0) )
    call TriggerAddAction( gg_trg_Nahkampf_Initialisierung, function Trig_Nahkampf_Initialisierung_Actions )
endfunction


Tested this with temporary and permanent deformations, with immediate TerrainDeformStop/fading and with putting a wait between creation and stopping, every combination.

Not every handle needs to be nulled. These with a high id have to be, which are generally agents. Do not ask me why is no agent. Most non-agent handles are static types like or local ones like
which have no reference-counter.
 

Bribe

vJass errors are legion
handle pointers consume RAM just by existing, and if there are some handles that have no reference counter it would surprise me and I would like to see proof / list.
 
I did not mean that local non-agent handle pointers get released at the end of their function. This, I do not know. Ok, that could be a reason to nullify them if that did help. But said objects are not reference-counted, already freeing their id upon the destroy-function.

JASS:
function Trig_Nahkampf_Initialisierung_Actions takes nothing returns nothing
    local lightning l = AddLightning("MBUR", false, 0, 0, 0, 0)

    call DestroyLightning(l)

    call AddLightning("LEAS", false, 0, 0, 0, 0)

    call MoveLightning(l, false, 0, 0, 1000, 1000)
endfunction

//===========================================================================
function InitTrig_Nahkampf_Initialisierung takes nothing returns nothing
    set gg_trg_Nahkampf_Initialisierung = CreateTrigger(  )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Nahkampf_Initialisierung, Player(0) )
    call TriggerAddAction( gg_trg_Nahkampf_Initialisierung, function Trig_Nahkampf_Initialisierung_Actions )
endfunction


Variable l points to MBUR first, MBUR gets deleted, restores the id although l still on it, LEAS obtains the just returned id and can be accessed through l, drawing the lariat to given coordinates.

As lightnings and some other stuff are not relevant for gameplay and local-only, I guess you do not need as much security.
 

Bribe

vJass errors are legion
Then I'll run some tests and figure out if the RAM increases with more unfreed pointers to lightnings, texttags, etc. If they don't hurt RAM, don't affect the handle stack, then there is probably no reason to null them?
 

PurgeandFire

zxcvmkgdfg
>It does not. Or why do the ids climb up?

Yeah, you're right. I accidentally was reading the id of null, so I tested it again and it seems that it does leak. =(
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    check out this place apparently it is the best roommate site out there roommates.com lol
  • Varine Varine:
    The homeless people reminded me of New York
  • Varine Varine:
    I'll check it out, my lease expires in like a few months so I need to figure something out.
  • Varine Varine:
    I tried to open a food truck in Sandpoint a few years ago but the city said no, then like two years later they passed new laws to encourage it and gave them all fucking tax breaks and shit. And at that point I didn't have enough money to go buy one so I was way too late to the game once other cities realized they could just bring their existing truck there, or sell their brick and mortar.
  • Varine Varine:
    I do like food trucks though, they're way more fun than restaurants and usually I also get some of that tip money there.
  • Varine Varine:
    Restaurants are really hard if you don't have a back up source of income to fund them sometimes, in my experience most owners either got really really lucky, had existing money that allowed them to buy an already successful one, or they have family money to fall back on for loans. It's few and far between to see very inspiring success stories where the person actually got it through hard work and perseverance. I thought about opening one lots and I always just end up not thinking it'll work. I would much rather just find someone that has that money and go work for them
  • The Helper The Helper:
    i am not talking about opening a brick and mortar I am talking about food trucks though I have seen some brick and mortar mexican places open up during covid that are doing good because there food is awesome!
  • The Helper The Helper:
    Food trucks are killing out here because Bars cannot open unless they sell food and the governor ok'd the use of a food truck in front as serving food
  • The Helper The Helper:
    Just not enough food trucks
  • The Helper The Helper:
    a buddy of mine just opened up a food truck and he is killing it but he is a great cook and has awesome food right in the middle of the pandemic too food trucks are immune to pandemic because they are take out in Texas you will always be able to get take out or delivery
  • The Helper The Helper:
    He is in the different food facebook groups in houston and posts videos of him making his food
  • The Helper The Helper:
    he is killing it
  • jonas jonas:
    @Varine with the restaurants, there surely is a lot of luck and hard work but most restaurants fail because they suck. Flair isn't right, economics not well thought through, food is mediocre or sucks, location is bad, etc. If you're thinking about opening one, make sure you're looking at the stories of those that would be playing at your level, don't let your hopes be dragged down by all the subpar restaurants out there.
  • jonas jonas:
    I'm a bit worried about the future of data science, there's an influx of incompetent people hired by incompetent managers, that can't last. But I'm sure smart data scientists will always be useful and hireable. Same as smart security people.
  • jonas jonas:
    My sister in law worked in a vegan food truck, the owners were also making a killing, added several trucks and opened two restaurants over 5 years
  • Ghan Ghan:
    The CompTIA stuff is pretty much crap unfortunately. The places that ask for those low-level certs aren't likely places you want to work. For IT you really want a degree, but in the meantime you need to figure out some way to learn the skills. Cybersecurity is really hot right now so competition is fierce.
  • tom_mai78101 tom_mai78101:
    I realized I don't have anything much to say, other than "Good luck!". Compared to other places, I'm just very lucky we didn't have a lot of surges of cases coming in.
  • The Helper The Helper:
    My daughter just got back from school at Georgetown TX, outside of Austin and said there were 100 cases in the last week but she also said nobody was wearing a mask anywhere so people mask up and stay safe!
    +2
  • thewrongvine thewrongvine:
    happy thanksgiving folks!
    +1
  • Ralle Ralle:
    PLOOB
  • Varine Varine:
    @Gyah Yeah I figured they aren't particularly valuable, but they'll at the least act as a baseline for some entry level work somewhere.
  • Varine Varine:
    I now see how horribly I spelled @Ghan
  • Varine Varine:
    I had a rough morning
  • The Helper The Helper:
    that field is going to explode and though there is competition there is going to be room for all levels in the coming years imho.
  • tom_mai78101 tom_mai78101:
    Why are we competing for rough mornings? :(

    Members online

    No members online now.

    Affiliates

    Hive Workshop
    Top