Hi All,

I am studying on how to build custom component by using as3. However,
i have found something interesting about the memory issue. i have
found that when i create component in as by using addChild() method,
the memory usage increased (by viewing the task manager), then, i try
to remove the newly created child, the memory doesn't drop, or even
increase!

i have written a very simple code in order to test to above statement:

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
label="Remove All" layout="absolute">

    <mx:Script>
        <![CDATA[
            import mx.controls.Button;
                        import mx.controls.TextInput;
            
            public function addButton():void {
                for (var i = 0; i < 1000; i++) {
                var myButton:TextInput = new TextInput();
                myButton.text = "New TextInput";
                myHBox.addChild(myButton);
             }
            }
            
            public function removeButton():void {
                myHBox.removeAllChildren();
                mx.controls.Alert.show(String(myHBox.numChildren));
            }

        ]]>
    </mx:Script>
    <mx:Button click="removeButton();" label="Remove All" x="10" y="10"/>

    <mx:HBox id="myHBox" x="227" y="52"/>
<mx:Button click="addButton();" label="Add" x="212" y="106"/>
</mx:Application>



it is noticed that once i check the "add" button, the memory increase
rapidly. when i click the remove all button, the memory remind the same. 

i have read the livedoc, the article there told us that the un-used
components should be removed in order to let the garbage collector to
free up the memory. However, in my testing application, it seems that
it doesn't work.

I am concerning about on using flex to build a web application system,
say, an ERP system. What i can think of is that, the user will keep
restarting the computer (or restarting the IE) in order to free up the
memory as they will feel the flex system running slow in a short
period of time!

thank you.







 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcomponents/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to