I read the documentation on KineticJS Docs and it says that:
destroy() - remove and destroy self
remove() - remove self from parent, but don't destroy
If what I understand is correct, the remove() function removes the node from the parent but is still allocated in the memory. Whereas destroy() completely frees the memory, is that correct? Can somebody explain in layman terms what are some complications if I used destroy over remove?
Thank you in advance.
Warmest Regards, Dandy Ling
I believe you are right, but just to add to what you said I would think that you would use:
remove() - to remove a node and possibly use that node later
destroy() - to destroy a node completely if you know you won't need this node any longer
Also, here are some benefits and disadvantages to Garbage Collection taken directly from the wiki: http://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29
And also here's another reference from SO: How does the Garbage Collection mechanism work?