7 Replies Latest reply on Apr 11, 2008 10:17 AM by

    Saving files causes Memoryleaks

      Hi there,

      I just ran into a strange problem. In my application I use a class, wich opens a new utility-window and loads an external swf. This swf is some kind of admin-panel to change some XML-Data. So far so good. The problem is, that whenever the XML-Data has been saved and the restart-function of the program is called, the memory-usage increases. Calling the restart-function without saving the XML-File doesn't cause any increasion. This is pretty confusing me, because my function for saving the XML-File does nothing else than calling the normal restart-function after generating an outputstring, writing this string to a XML and closing the filestream. Any help is very appreciated, because this is the last thing that keeps me away from finishing my diploma.

      Another strange thing I noticed is, when loading an XML-file with the normal URLLoader and creating an XML-Object everything in my app works fine (except the memoryleak mentioned above). When I create the XML-Object using the filestream-method, I run into numerous errors. This is pretty strange because a trace of the XML-Object shows that it's similar to the XML-Object created with the Loader-Method. Any suggestions about that?

      Thanks in advance.
      hellslawyer
        • 1. Re: Saving files causes Memoryleaks
          enorton@adobe Level 1
          Hi hellslawyer,

          What tool are you using to develop your app? If you're using Flex Builder 3, have you tried using the new profiler tools?

          I'm not sure what you mean by "whenever the XML-Data has been saved and the restart-function of the program is called" - saved how? and restart-function - quit and relaunch the app? something else?

          Do you have any very simple code that demonstrates the problem?

          Thanks!
          -Erica
          1 person found this helpful
          • 2. Re: Saving files causes Memoryleaks
            quote:

            Originally posted by: enorton@adobe
            Hi hellslawyer,

            What tool are you using to develop your app? If you're using Flex Builder 3, have you tried using the new profiler tools?

            I'm using Flash CS3 to develop.

            quote:

            I'm not sure what you mean by "whenever the XML-Data has been saved and the restart-function of the program is called" - saved how? and restart-function - quit and relaunch the app? something else?

            The XML-Data is saved using a simple filestream which writes a faily long String into the xml-file. The restart-function is a function I wrote which simply kills all references, and removes all children from the stage. After that the first function of the document-class is called which "rebuilds" the application. The app ist not closed and relaunched. There are two ways of calling the "restart"-function I tested. 1. saving the xml and calling the function automatically after the file is written (which causes the leaks), 2. closing the native window with the external swf and call the restart-function manually (which causes no leaks). The only difference between those two ways is that in one case some data is written and in the other case no data is written.

            quote:

            Do you have any very simple code that demonstrates the problem?

            Thanks!
            -Erica


            Here is the function for saving the xml. Hope it helps:
            function xmlsaver(e:MouseEvent){
            var outputString:String = '<?xml version="1.0" encoding="utf-8"?>\n<vars>\n\n<hotspots>\n';
            outputString += 'Insert faily long from variables here';
            var stream:FileStream = new FileStream();
            stream.open(xmldirectory, FileMode.WRITE);
            stream.writeUTFBytes(outputString);
            stream.close();
            closeit(e);
            }

            The function closeit(e); is also called, when closing the native window without saving. So this is what keeps me stuck, because there is simply no difference between closing without saving and closing with saving the file, except the writing of the file. There are a lot of things which happen afterwards, but these things are always called and performed and have no effect on the leaks.

            Many thanks in advance for every answer.
            Greetz
            Reinhart
            • 3. Re: Saving files causes Memoryleaks
              enorton@adobe Level 1
              Hi Reinhart,

              Thanks for this report. I've forwarded it on to our team member that's our expert on investigating potential memory leaks :)

              -Erica

              1 person found this helpful
              • 4. Re: Saving files causes Memoryleaks
                Ok, I hope he will find a solution for that because it made my hair already go grey. If he needs my app to investigate this issue I can upload it for him. As it is my diploma, please be appreciative of the fact, that I won't provide this link here in public. But you can contact me for instant access to the app under info@reinhart-redel.com

                Thanks in advance
                Reinhart
                • 5. Re: Saving files causes Memoryleaks
                  Are there any news concerning this issue. Is this indeed a bug or is there anything wrong with my code?

                  Greetz
                  Reinhart
                  • 6. Re: Saving files causes Memoryleaks
                    mkagita Adobe Employee
                    hi,

                    I've sent email to info@reinhart-redel.com requesting more information including access to the application if possible. If you can privately reply to my email that would be appreciated. thanks.
                    1 person found this helpful
                    • 7. Re: Saving files causes Memoryleaks
                      Hi mkagita,

                      I wrote two private messages to you including the download-link for the application. I hope you got them. Did you find any solution for the problem? It seems, that I didn't get your mail or deleted it by an oversight. Feel free to contact me via mail or phone at any time, if you have any more questions regarding this issue.

                      Greetz
                      Reinhart