when to use object.free and freeandnil(object); [duplicate]
Possible Duplicate:
Which is preferable: Free or FreeAndNil?
when to use free and freeandnil?
in my way, i usually use the .free when the object that created is something like "object.create;" that has no self or nil parameter. if there is, that's the time i will use the freeandnil();
am i doing it right? or it has a big deference?
FreeAndNil sometimes works against you; see the article "a case against FreeAndNil" from Allen Bauer (Chief Scientist at Embarcadero) about the use of FreeAndNil and the follow up article by him titled "a case when FreeAndNil is your enemy".
Note that FreeAndNil is not bad, but you need to know what it does to oversee its consequences.
--jeroen
精彩评论