# Garbage Collection!

**URL:** <https://forum.kirupa.com/t/garbage-collection/246896>\
**Category:** flash\
**Created:** [December 15, 2007, 11:54pm UTC](https://forum.kirupa.com/t/garbage-collection/246896 "2007-12-15T23:54:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonhallman](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@jonhallman](https://forum.kirupa.com/u/jonhallman)\
**Post date:** [December 15, 2007, 11:54pm UTC](https://forum.kirupa.com/t/garbage-collection/246896/1 "2007-12-15T23:54:30Z")

</div>

Ok, so after using the Profiler perspective in flex, I’ve been scared to death of memory leaks. Top on my list of things to do is to find a fix. I have an idea that could work, but definitely needs a better approach. If anyone knows of some rare, help methods that could turn this into something, please let me know.

So I just found out about the flash.utils.describeType function that retrieves a list of everything about an object. I use it to find all the variables I’ll be nulling when I want to erase an object for garbage collection. I have a function “destroy” that will run a loop that sets all of the non-number variables to null before removing the child. Now, is there a function that I could use instead of running a loop?–it’s a bit CPU intensive. also, because I’m using something like Child[“variable”] = null; to nullify a property, it won’t work with private variables. the thing is, the memory is next to nothing whenever I have the destroy function working whenever I want to get rid of something, but I can tell there’s a bit of lagging.

anything will help. thanks.

(i’m sure senocular will quickly refer me to one of his posts I’ve overlooked ;))
