2 Replies Latest reply on Jan 31, 2008 7:53 AM by ChiefRocka00

    Do modules cause memory problems?

    ChiefRocka00 Level 1
      I have a big app that I decided to make modular. Everything seemed to be going along smoothly at first as I started adding modules. Now I have upwards of 40 modules and the app runs slow on the client side and it takes forever for Flex Builder to build as well. I kept getting an out of memory error so I upped my FlexBuilder.ini parameter to -Xmx1024M. I am not getting the memory problem, it does eventually build, but it takes a few minutes. I guess my question is, does the number of modules I have in an application have this big of an affect on building the application? I have 1.5 gig of RAM and now allocating upwards of 2/3 of it to Flex Builder if it needs it. Is there a better way or do I just deal with it?
        • 1. Re: Do modules cause memory problems?
          Ratsnackbar Level 2
          If the modules are large it's possible that your stuck with it but that is a rare situation. Likely you have a couple of things you can do.

          First is do not load a module until you really need to. This I assume you already know. Inside each of the modules you will want to take the same approach. Delay the creation of objects (UI or otherwise) until the application actually needs them.

          Second is you may have memory leaks: Might want to check out this article by Grant Skinner if you have not already.

          My guess is that you have loitering objects and runaway event listeners that all need to be stopped, closed down or de-referenced or the garbage collector cannot collect them and eventually you run out of memory.

          If you have Flex 3 Beta 3 you can use the profiler to check for Loitering Objects and verify that when you close certain objects down that the memory is returning to where it should be or at least reasonably close.

          Either way the articles from Grant Skinner are a good read.
          • 2. Re: Do modules cause memory problems?
            ChiefRocka00 Level 1
            I will look at those articles, thank you!