# Memory Optimization

**URL:** <https://forum.kirupa.com/t/memory-optimization/226162>\
**Category:** flash\
**Created:** [May 18, 2007, 2:55pm UTC](https://forum.kirupa.com/t/memory-optimization/226162 "2007-05-18T14:55:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eudora](https://avatars.discourse-cdn.com/v4/letter/e/f14d63/32.png) [@eudora](https://forum.kirupa.com/u/eudora)\
**Post date:** [May 18, 2007, 2:55pm UTC](https://forum.kirupa.com/t/memory-optimization/226162/1 "2007-05-18T14:55:41Z")

</div>

Hi all, I am 1/4 way into my game engine… currently I feel that it has some memory issues. ;( Using the activegraph, I can see my line chart keep going up one… lol

Just some question, is it only objects which are displayed will occupy memory? What about code and variables? Do I have to clear them? Arrays?

I am building a tetris game, so bricks are continually added into my game, when they are exploded, I remove them using…

```php

            if(numChildren > 0){                
                while(numChildren) removeChildAt(0);
            }
            this.parent.removeChild(this);

```

Do i need to do more?
