• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Unit Leak Knowledge Equal to null

Status
Not open for further replies.
Level 5
Joined
Oct 24, 2007
Messages
90
Hello. Take a look at this code:

JASS:
struct Example
    unit Dummy

    static method create takes nothing returns Example
        local Example ex = Example.allocate()
        //bla bla bla...
        set ex.Dummy = CreateUnit(bla bla)
        return ex
    endmethod

    method somemethod takes nothing returns nothing
        call KillUnit(this.Dummy)
        call this.destroy()
    endmethod
endstruct

Does that leak? Do I have to set this.Dummy to null before destroying structs or does killing units set them to null indirectly? Or... does destroying structs null all their members? It doesn't seem like it would leak at all to me, but I just want to make sure, since there are a couple of functions with that structure that may be potential leaks to my map. Thanks.
 
Status
Not open for further replies.
Top