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.
__._,_.___![]()
SPONSORED LINKS
Custom software development Database development software Embedded software development Offshore software development Software development
YAHOO! GROUPS LINKS
- Visit your group "flexcomponents" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
__,_._,___
- [flexcomponents] Memory issue when building custom comp... ncelq
- Re: [flexcomponents] Memory issue when building cu... Dominick Accattato
Reply via email to
What happens when you click the add button a second time? Does the memory increase again? I wonder if the garbage collector just hasn't had time to clean up yet. Try removing myHBox and see what happens?
On 8/8/06, ncelq <[EMAIL PROTECTED]> wrote:
