# Best practices for removing objects?

**URL:** <https://forum.kirupa.com/t/best-practices-for-removing-objects/285627>\
**Category:** flash\
**Created:** [April 3, 2009, 5:14am UTC](https://forum.kirupa.com/t/best-practices-for-removing-objects/285627 "2009-04-03T05:14:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dandylion13](https://avatars.discourse-cdn.com/v4/letter/d/c89c15/32.png) [@dandylion13](https://forum.kirupa.com/u/dandylion13)\
**Post date:** [April 3, 2009, 5:14am UTC](https://forum.kirupa.com/t/best-practices-for-removing-objects/285627/1 "2009-04-03T05:14:31Z")

</div>

Hello 🙂

I have a question about how best to remove display objects.

removeChild(object);

Given that there are no other reference to this object, does using removeChild alone make the object eligible for garbage collection, or does it also need to be given a null value as well?

I’ve tried both:

removeChild(object);  
object = null;

and

object = null;  
removeChild(object);

In both these cases, I get the classic 1009 error. That leads me to believe that if you use removeChild, you don’t also need to give the object a null value…?

The documentation seems to say it is but any confirmation would be helpful 🙂 Thanks!

[http://help.adobe.com/en\_US/AS3LCR/Flash\_10.0/flash/display/DisplayObjectContainer.html#removeChild()](http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/display/DisplayObjectContainer.html#removeChild())
