| |
|
Thedagz
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 798 |
|
|
| 17 Oct 2017 09:12 PM |
define effective
Need Help With scripting or Hire Scripters? Go here! via Discord : discord DOT gg/rfnudw6 |
|
|
| Report Abuse |
|
|
| |
|
|
| 17 Oct 2017 09:14 PM |
Remove - Remove from game, but not deleted it. Destroy - Terminate it, and have it be garbage collected. |
|
|
| Report Abuse |
|
|
|
| 17 Oct 2017 09:14 PM |
are you serious right now kid.. every programmer knows that it's just as effective
|
|
|
| Report Abuse |
|
|
|
| 17 Oct 2017 09:16 PM |
| when you make something nil is it garbage collected? asking out of curiousity lol |
|
|
| Report Abuse |
|
|
Thedagz
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 798 |
|
|
| 17 Oct 2017 09:17 PM |
I believe it is, when there no longer any reference to it.. than it might eventually be garbage collected
Need Help With scripting or Hire Scripters? Go here! via Discord : discord DOT gg/rfnudw6 |
|
|
| Report Abuse |
|
|
| |
|
|
| 17 Oct 2017 09:19 PM |
| I don't think so, b/c all `Remove` does is set an object's parent object to nil, while for `Destroy` it "terminates" said object, and has it be garbage collection, which then it'll be removed from memory eventually. (I think from the memory; can't recall. Please correct me if I'm wrong about that. ;c ) |
|
|
| Report Abuse |
|
|
PuddyTats
|
  |
| Joined: 03 Apr 2008 |
| Total Posts: 79351 |
|
|
| 17 Oct 2017 09:23 PM |
Yeah, it's from memory ^
And I don't think parenting it to nil does anything because that's why they added Destroy. They would have left it otherwise. |
|
|
| Report Abuse |
|
|
|
| 17 Oct 2017 09:46 PM |
| :Remove() is deprecated anyways so don't use it. |
|
|
| Report Abuse |
|
|
|
| 17 Oct 2017 09:46 PM |
You're all somewhat right. No, Destroy isn't the same as Remove or parenting to nil. Destroy kills all connections (which count as references) and locks the parent at nil.
It still follows GC rules and will only be collected once out of references. |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 17 Oct 2017 09:51 PM |
...
Remove: Sets parent to nil and calls Remove on all children.
Destroy: Sets parent to nil, locks parent, disconnects all connections associated with it and calls Destroy on all children.
Parenting to nil: Completely pointless unless you want to bring it back later.
None of these have anything to do with garbage collection.
The object will get garbage collected (eventually) when there are no strong references to it. |
|
|
| Report Abuse |
|
|
|
| 17 Oct 2017 09:53 PM |
@chimmihc Connections affect GC because often times the object will be referenced as an upvalue. |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 17 Oct 2017 09:57 PM |
| I was refuting things like "Destroy - Terminate it, and have it be garbage collected". |
|
|
| Report Abuse |
|
|