generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: is :Destroy() just as effective as parenting something nil?

Previous Thread :: Next Thread 
Horrible_Pun is not online. Horrible_Pun
Joined: 13 May 2017
Total Posts: 5102
17 Oct 2017 09:12 PM
?
Report Abuse
Thedagz is not online. 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
Horrible_Pun is not online. Horrible_Pun
Joined: 13 May 2017
Total Posts: 5102
17 Oct 2017 09:13 PM
making something nil***
Report Abuse
TheeDeathCaster is online. TheeDeathCaster
Joined: 19 Jun 2011
Total Posts: 1191
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
BloodLitch101 is not online. BloodLitch101
Joined: 13 Jul 2011
Total Posts: 941
17 Oct 2017 09:14 PM
are you serious right now kid.. every programmer knows that it's just as effective


Report Abuse
Horrible_Pun is not online. Horrible_Pun
Joined: 13 May 2017
Total Posts: 5102
17 Oct 2017 09:16 PM
when you make something nil is it garbage collected? asking out of curiousity lol
Report Abuse
Thedagz is not online. 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
Horrible_Pun is not online. Horrible_Pun
Joined: 13 May 2017
Total Posts: 5102
17 Oct 2017 09:17 PM
true, thanks
Report Abuse
TheeDeathCaster is online. TheeDeathCaster
Joined: 19 Jun 2011
Total Posts: 1191
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 is not online. 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
HardCoreDev is not online. HardCoreDev
Joined: 19 Nov 2015
Total Posts: 112
17 Oct 2017 09:46 PM
:Remove() is deprecated anyways so don't use it.
Report Abuse
Shining_Diamando is not online. Shining_Diamando
Joined: 11 Oct 2014
Total Posts: 460
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 is not online. 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
Shining_Diamando is not online. Shining_Diamando
Joined: 11 Oct 2014
Total Posts: 460
17 Oct 2017 09:53 PM
@chimmihc
Connections affect GC because often times the object will be referenced as an upvalue.
Report Abuse
chimmihc is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image