6 Replies Latest reply on Feb 10, 2010 10:36 AM by jimmyoneshot

    Out of Memeory Eroors Whn Saving My Huge Applications

    jimmyoneshot Level 1

      I am now constantly getting an out of memory error every time I try to save changes to an application I've made. Something to do with java heap space. The app is very big, almost 15,000 lines long in code with over 50 embedded png images, but this problem makes it too hard to go back and try to trim it down.

       

      Is there any way around this problem or a workaround of some sort?

        • 1. Re: Out of Memory Errors When Saving My Huge Applications
          jimmyoneshot Level 1

          Sorry. Spelling Corrections from title:-

           

          *Memory

          *Errors

          *When

           

          I hate typing on my laptop

          • 2. Re: Out of Memory Errors When Saving My Huge Applications
            jimmyoneshot Level 1

            It's strange but this error has now made Flex totally unusable in the case of this application. It is completely ridiculous. Maybe I could build my apps more professionally so that they take up less line's of code but as I said it's an app I made early on and it's too late to go back and change it now. It's almost as if when an app goes beyond a certain amount of code flex can't run it anymore.

             

            Is there anyway of changing the memory allowance on flex so that this error doesn't occur? It has got to the point where I type a letter and click save and flex can't save this change without this error occurring

            • 3. Re: Out of Memory Errors When Saving My Huge Applications
              Gregory Lafrance Level 6

              If this post answers your question or helps, please mark it as such.


              Greg Lafrance - Flex 2 and 3 ACE certified

              www.ChikaraDev.com

              Flex / AIR Development, Training, and Support Services
              ------------------------------------------------------------------------------------------ -------------------------------------

              See this link:

               

              http://livedocs.adobe.com/flex/3/html/help.html?content=configuring_environment_3.html

               

              And also this from the Flex Builder help systems:

               

              Allocating enough memory and solving OutOfMemoryErrors


              By default, Eclipse will allocate up to 256 megabytes of Java heap memory. This should be ample for all typical development tasks. However, depending on the JRE that you are running, the number of additional plug-ins you are using, and the number of files you will be working with, you could conceivably have to increase this amount. Eclipse allows you to pass arguments directly to the Java VM using the -vmargs command line argument, which must follow all other Eclipse specific arguments. Thus, to increase the available heap memory, you would typically use:

               

              eclipse -vmargs -Xmx<memory size>

               

              with the <memory size> value set to greater than "256M" (256 megabytes -- the default).

               

              When using a Sun VM, you may also need to increase the size of the permanent generation memory. The default maximum is 64 megabytes, but more may be needed depending on your plug-in configuration and use. When the VM runs out of permanent generation memory, it may crash or hang during class loading. This failure is less common when using Sun JRE version 1.5.0_07 or greater. The maximum permanent generation size is increased using the -XX:MaxPermSize=<memory size> argument:

               

              eclipse -vmargs -XX:MaxPermSize=<memory size>

               

              This argument may not be available for all VM versions and platforms; consult your VM documentation for more details.

              Note that setting memory sizes to be larger than the amount of available physical memory on your machine will cause Java to "thrash" as it copies objects back and forth to virtual memory, which will severely degrade your performance.

              1 person found this helpful
              • 4. Re: Out of Memory Errors When Saving My Huge Applications
                jimmyoneshot Level 1

                Cheers Greg.

                 

                So it can likely be solved by adding that specific command line to a file? Where exactly would I find this file do you know?

                 

                It just seems that there are a lot of conflicting solutions I've seen for this problem. I've read it can be solved by editing the eclipse.ini file by adding this same command line into the file but I can't seem to find it. I'm on Vista and am running Flex 3.2.

                 

                Sorry for sounding silly. It's just that I'm only a flex student really and have little experience in editing files and java runtime environments etc.

                • 5. Re: Out of Memory Errors When Saving My Huge Applications
                  jimmyoneshot Level 1

                  I managed to find the jvm config file and have changed the line from:-

                   

                  java.args=-Xmx384m -Dsun.io.useCanonCaches=false

                  to

                  java.args=-Xms256m -Xmx512m -Dsun.io.useCanonCaches=false

                  However I've just tried to run the same application I'm talking about and this resulted in the same out of memory + "do you want to exit the workbench" error

                   

                  • 6. Re: Out of Memory Errors When Saving My Huge Applications
                    jimmyoneshot Level 1

                    Ok my attention has now gone from adapting my applications and learning Flex to searching for a tonne of ways to fix a ridiculous out of memory error because I now can't even run these apps. Does anyone else find it ridiculous that we have to work with a system which once an application/project gets above a specific size will crash with one of these errors? And the only solution to this is to edit files and command lines it seems, which I'm scared to do 1 because I know nothing about doing this and 2 because I'm worried this may damage my system. My system has 2 gig of RAM so these errors shouldn't be occurring and I'm a student trying to get a qualification in flex and web development so I can get a job but may fail thanks to this error it seems. Awful awful problem which puts me at a total dead end. Sort it out Adobe.

                     

                    Sorry for the rant. The things I've tried so far are:-

                     

                    - Going into the jvm config file in Computer/C/ProgramFiles(86)/Adobe/FlexBuilder3/sdks/3.2.0/bin/ and changing the line:-

                     

                    java.args=-Xmx384m -Dsun.io.useCanonCaches=false

                    to

                     

                    java.args=-Xms256m -Xmx512m -Dsun.io.useCanonCaches=false

                     

                    Which didn't seem to work as the same out of memory error occured when I tried to run the app again

                     

                    - Edited the flexBuilder.ini file in Computer/C/ProgramFiles(86)/Adobe/FlexBuilder3/ and changed it so that the whole file reads the following exactly:-

                     

                    -vmargs
                    -Xms256m
                    -Xmx512m
                    -XX:MaxPermSize=512m
                    -XX:PermSize=64m
                    -Djava.net.preferIPv4Stack=true

                     

                    This again never worked and the same out of memory error occurred when running the app.

                     

                    I simply can't find the Eclipse.ini file at all but don't know if that would make a difference. I am using "JSEclipse" according to Flex.

                     

                    Can anyone give me further assistance with this at all or would I need to provide further details of my system etc?

                     

                    I feel embarassed asking but wouldn't if I wasn't desperate. Thanks to Greg for the suggestions so far.