2 Replies Latest reply: Jan 24, 2012 6:00 AM by dinko_ivanov RSS

    ¿SpellUI memory leak?

    AntuanSoft Community Member

      Hi! everybody.

       

      We are trying to integrate de SpellUI component in our Flex application and we have a problem when we remove the view where de SpellUI is applied.

       

      We have a test application to profile the memory with a main view that load a component with a textarea where the SpellUI is applied.

       

      The main view can add a child with the component and can remove it. We have a enableSpelling button to enable the word checking and if the spelling is active, the main view can´t remove the componet it is still in memory and it can´t be removed.

       

      ¿Are there any way in order to remove the static reference of the SpellUI in the textarea where it is applied?, i think that it is the problem why the component can´t be removed of the memory.

       

      The code: Compiled with Flex 4.0 (Sorry the main app is in a mx and the Component is spark but its works)

       

      SquigglyUIExample.mxml

       

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*">

       

      <mx:Script>

       

      <![CDATA[

           import mx.collections.ArrayCollection;

           import mx.core.UIComponent;

       

           private var texts:ArrayCollection = new ArrayCollection();

       

           private function addDictionary():void{

       

                var text:UIComponent = new TextAreaTest();

                text.left = 10;

                text.top = 40;

                texts.addItem(text);

                this.addElement(text);

       

           }

       

           private function deleteDictionary():void{

       

                for (var i:int = 0; i< texts.length;i++){

                     var text:UIComponent = texts[i];

                     this.removeElement(text);

                     texts.removeItemAt(i);

                }

       

       

           }

      ]]>

      </mx:Script>

       

       

       

      <mx:Button label="remove" x="235" y="10" click="deleteDictionary()"/>

      <mx:Button label="add" x="153" y="10" click="addDictionary()"/>

       

       

      </mx:Application>

       

      TextAreaTest.mxml

       

      <?xml version="1.0" encoding="utf-8"?>

      <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"

      xmlns:s="library://ns.adobe.com/flex/spark"

      xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%">

      <fx:Declarations>

      <!-- Place non-visual elements (e.g., services, value objects) here -->

      </fx:Declarations>

       

      <fx:Script>

      <![CDATA[

           import com.adobe.linguistics.spelling.SpellUI;

       

           private function enableFeature():void {

                SpellUI.enableSpelling(textArea, "en_US");

           }

           private function disableFeature() :void {

                SpellUI.disableSpelling(textArea);

       

       

       

           }

       

      ]]>

      </fx:Script>

       

      <mx:TextArea id="textArea" width="20%" height="20%" fontSize="30" text="Spell cheecking in TextArea " top="10" left="50"/>

      <mx:Button id="tt1" label="disable Feature" click="disableFeature()" left="200" top="160"/>

      <mx:Button id="tt2" label="enable Feature" click="enableFeature()" left="60" top="160"/>

       

      </s:Group>

      Thanks.

        • 1. Re: ¿SpellUI memory leak?
          AntuanSoft Community Member

          ¿Nobody are worry about memory leaks? or my english is so bad and i explained the problem very bad. .

           

          I only want to confirm with Squiggly developers that this memory leak exists or i´m doing something wrong when the static function SpellUI.enableSpelling is used. do you need more info? ask me please.

           

          I probed with others parts of the Squgglly framework like the TextEditor Example where SpellChecker and HunspellDictionary are created and there is no memory leak, every thing are destroyed properly.

           

          Thanks.

          • 2. Re: ¿SpellUI memory leak?
            dinko_ivanov

            Hello,

             

            We also observe the memory leak. The problem does not seem to occur when SpellUI for MX TextArea (AdobeSpellingUI.swc) is used, but when we use SpellUI for Spark TextArea (AdobeSpellingUIEx.swc).

             

            We are enabling the spelling for a text area on ADDED_TO_STAGE and disabling the spelling on REMOVED_FROM_STAGE. We do this in a test AIR application for 100 Spark text fiedls. The memory footprint after removal of the text areas is around 22 MB.

             

            Any help is appreciated.

             

            Best Regards,

            Dinko Ivanov