Memory leak when loading .swf in AS3?

Hi all,
I've got a pretty big issue here that I can't understand.
I've got a pretty simple app that just repeatedly loads and then
unloads an .swf called test.swf (this loaded .swf contains nothing
but a document class and a graphic - a circle. The document class
is blank, it just extends Sprite).
When I set this class as the document class of a blank .swf,
I trace the 'totalMemory' of the flash player, and load and unload
the (very simple) clip over and over. You'd think that with garbage
collection and all that, the memory would stay pretty
constant...but no! It increases (and continues to for as long as
I've run it!).
I'm writing an application that loads and unloads many many
.swf files, but it needs to have the smallest footprint
possible...any ideas as to why the memory is never released?

One idea - there is a separate stack of memory in the flash
player where loaded classes in separate application domains exist,
and these classes are not being garbage collected....however, there
is a line in adobe's documentation here:
http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Liv eDocs_Parts&file=00000327.html
under "Usage C" :
quote:
Having a new application domain also allows you to unload all
the class definitions for garbage collection, if you can ensure
that you do not continue to have references to the child SWF.
Given that, as far as I can see from this code, there is no
reference to the loaded .swf maintained....it seems to me like the
loaded data (graphical assets AND classes) should be garbage
collected - but, while you WILL see a slight drop in memory after
the removal of the SWF, the overall memory continues to increase
the more you do it. Could Adobe be mistaken?

Similar Messages

  • Memory Leak when TOMCAT connects to Oracle 10g RAC using JDBC Thin driver.

    We had experienced Memory leak when a Oracle 10g (10.2.0.3) RAC node was evicted. TOMCAT app server is connecting to the Oracle 10g RAC database instances using JDBC 10.2.0.3 thin driver.
    Anyone had similar experience?
    Any ideas? Any bugs reported/fixed?
    Thanks,
    Raj

    If you're doing XA, we absolutely do not support
    driver-level load-balancing OR failover. Use neither.
    For non-XA, you can use driver-level failover. For
    non-XA, you could set load-balancing, but it won't
    help because we get connections from the driver,
    and keep them indefinitely, so the driver never gets
    the chance to affect which connections the pool
    uses after that.

  • Memory Leak when running Contacts

    I am having a big memory leak when running the app Contacts on a MB Air. It gobbles up 2 GB of ram in just a few minutes forcing a reboot. I have re-installed Mountain Lion 10.8.2 and it still leaks memory. Watching Activity Monitor shows the rapid increase in Ram being gobbled up by Contacts. Used Mackeeper to clear cache as well as ran Cocktail, all to no avail. Any tips would be greatly appreciated.

    The size of oracle.exe is not an indication of how the Java VM GC works; so you are not comparing apples to apples. It'll be too long to explain here but in my upcoming book (see hereafter), I gave a detailled explanation of the various memory areas the Java VM uses and how these are GCed and also how you can meausre their size (not all, though).
    In short you want to use OracleRuntime methods such as
    OracleRuntime.getSessionSize(); --> get he current size of Sessionspace
    OracleRuntime.getNewspaceSize(); --> get he current size of Newspace
    there are other memory areas described in the book
    http://www.oracle.com/technology/pub/articles/mensah_dws.html
    http://www.elsevier.com/wps/find/bookdescription.cws_home/706089/description#description
    Sample chapter: http://www.oracle.com/technology/books/pdfs/mensah_ch1.pdf
    Kuassi

  • App Memory Leak When Open iPhoto

    Hi everyone,
    Does anyone have experienced app memory leak when open iPhoto?  My free memory immediate dropped from 5000 mb to 15mb when I open iPhoto and the app never open.  If I force to quit iPhoto, all return to normal and everything work fine.  I only have iPhoto app running, not sure what caused the memory leak??? 
    Looking for help. 
    Thanks
    JHML

    Actually the new library was a test to see if the problem occurred only with your current library or with all libraries.  The fact that switching libraries cleared up the problem is just serendipitous. 

  • Memory leak when using Threads?

    I did an experiment and noticed a memory leak when I was using threads.. Here's what I did.
    ======================================
    while( true )
         Scanner sc = new Scanner(System.in);
         String answer;
         System.out.print("Press Enter to continue...");
         answer = sc.next();
         new TestThread();
    ========================================
    And TestThead is the following
    ========================================
    import java.io.*;
    import java.net.*;
    public class TestThread extends Thread
    public TestThread() { start(); }
    public void run() {  }
    =====================================
    When I open windows Task Manager, every time a new thread starts and stops, the java.exe increases the Mem Usage.. Its a memory leak!? What is going on in this situation.. If I start a thread and the it stops, and then I start a new thread, why does it use more memory?
    -Brian

    MoveScanner sc = new
    Scanner(System.in);out of the
    loop.Scanner sc = new Scanner(System.in);
    while (true) {
    That won't matter in any meaningful way.
    Every loop iteration creates a new Scanner, but it also makes a Scanner eligible for GC, so the net memory requirement of the program is constant.
    Now, of course, it's possible that the VM won't bother GCing until 64 MB worth of Scanners have been created, but we don't care about that. If we're allowing the GC 64 MB, then we don't care how it uses it or when it cleans it up.

  • Excessive memory consumption when loading Customers through Component Inter

    Hi All,
    I'm facing a big problem with the high memory consumption when loading Customers, Companies and Sites using the Component Interfaces delivered by the product (RD_CONSUMER_CI_API, RD_COMPANY_CI_API, RD_SITE_CI_API) within Application Engine programs. I'm loading about 7 million customers, an amount that is not so big in my opinion, but the memory consume is too high.
    We have 3 Batch Servers, each one running under Red Hat OS with 32 GB RAM memory plus 32 GB Swap memory in each server. We are running 2 Process by Server and with a day and half the servers crash with 100% of memory consumed (RAM and SWAP).
    There's a good pratice to use Component Interface in a heavy load process?
    There are parameters in the process scheduler configuration file that could help to reduce the memory consumption?
    There's a way to free the memory through PeopleCode or by running another process?
    Thanking you in advance.

    You may want to try and cut down on the input data to ascertain that the load might be a problem.
    You may try and use the GarbageCollector, but might not help in your case.
    To get an idea of the size allocated in buffer for the Rowset being used, you may want to check out the memory overhead ...
    Also, could check, which is the process that is consuming a lot of memory

  • [svn:osmf:] 15114: Don't check policy file when loading SWFs.

    Revision: 15114
    Revision: 15114
    Author:   [email protected]
    Date:     2010-03-29 12:24:58 -0700 (Mon, 29 Mar 2010)
    Log Message:
    Don't check policy file when loading SWFs.  Don't import local SWFs into current security domain.
    Modified Paths:
        osmf/trunk/framework/OSMF/org/osmf/elements/ImageLoader.as
        osmf/trunk/framework/OSMF/org/osmf/elements/SWFLoader.as
        osmf/trunk/framework/OSMF/org/osmf/elements/loaderClasses/LoaderUtils.as

    If you managed to get to the point where the applet container is created (the "gray square"), but the form never appears then you can assume one or more of the following has occurred:
    1. The JRE crashed after startup. Many times, but not always, if such a crash occurs it will leave a JRE dump file on the desktop. Its content may help to identify the cause.
    2. The Forms runtime crashed at startup. Many times, but not always, a Forms dump file will be created on the server. Its content may help to identify the cause.
    3. The Forms runtime was unable to start at all. This can occur on unix systems when/if there is a resource or permissions issue. One of the more common causes is if the file descriptor (nofiles) value is set too low.
    4. The applet is actually running, but has attempted to display a dialog box and is awaiting your acknowledgement, but the box was wrongfully sent to the background behind the browser. A similar issue was reported in one of the JRE 1.6.0_xx series, however I don't recall which one. Uninstall your current version and install the latest which is 1.6.0_27
    There are other possibilities, but these are most common.
    I would recommend the following:
    1. Uninstall any JRE older than 1.6.0_27. Reboot. Install 1.6.0_27
    2. Set networkRetries=5 in formsweb.cfg
    3. Set FORMS_TIMEOUT to 15 (default). Setting to a high value as you have is not recommended and is rarely necessary.
    4. Verify that the test form works. For example:
    http://machine:port/forms/frmservlet?form=test
    5. It appears that you are trying to use WU_TEST_106.fmx. Instead, download an updated version of this file (the name has also changed)
    http://www.oracle.com/ocom/groups/public/@otn/documents/webcontent/196249.zip
    6. Ensure that you have compiled webutil.pll into .plx. Do not use an old version of this file. The installation will include one. If not, check for it in an installation that also includes the Builders.

  • [iPhone] Memory leak when UIWebview is loaded with URL

    I have created a custom browser in my app using UIWebview . A memory leak is seen on everytime webview is loaded with provided  url. A snapshot of the leak is shown below.You may note that no back trace is shown and hence cause of leak is unknown.
    Snapshot of leak
    Please help me with this issue as early as possible.

    You might want to take this discussion to the developers forums. This is a general user to user forum for using the iPhone. This is way outside the scope of general use.

  • Memory leak when refreshing table models

    Hi,
    I have a memory leak in a GUI app, and i have traced the problem down to some JTables I have which display data from a database (I used Netbeans profiler to look at the number of objects created for different classes, and there are a large number of classes like com.mysql.jdbc.ResultSet, com.mysql.jdbc.Statement, com.mysql.jdbc.Field[] accumulating, aswell as lots of byte[] and char[] arrays). The allocation stack traces for these objects seem to point to my table models where I do a lot of database lookups to create the model.
    Every time I am refreshing the tables, the Heap Space increases by a few MegaBytes, and a load of objects get created and retained. After refreshing the tables a number of times, the heap eventually gets filled and I get OutOfMemory error.
    The problem is I don't understand how this is happening - when the tables are refreshed, the code I use is something like this:
    setModel(new MyTableModel());
    So theoretically each time I refresh, the old model should be garbage collected (because setting the new model means there are no references to the old model), but I get the feeling that all the models are accumulating in the heap and not being collected. I dont understand why this could be - I was wondering if anyone had any ideas? (PS My table models dont use any static fields)
    Cheers,
    james

    Hi JacobsB,
    The reason I'm setting new models (which I dont normally do) is that each time the table is refreshed, the number and type of columns may change. Since altering the column model is quite complicated (there is no convenient removeColumn() method of any of the standard model classes) and involves messing around with the column model, which ends up screwing up the whole model (e.g. column renderers, column count, column class etc.) I decided it was actually easier to just create a new model instead! Is there a way to alter the column structure another way?
    later,
    James

  • Memory leak when we include child vo attributes in search reqion

    Hi,
    We have an ADF application (11.1.1.4) running in production. This application has around 100 pages and it takes load around 150-200 requests per second during peak time.
    We have many search pages in this application which uses the feature of including child attributes in search region.
    For Example - Let say we have MasterVO1 , ChildVO1, ChildVO2 , ChildVO3 ... , Now we have ViewCriteria (vc1)defined in MasterVO1 which includes attributes from ChildVO1, ChildVO2.. etc. We have query region in page basing on ViewCriteria(vc1) and MasterVO1, ChildVO1 , ChildVO2... are used as tables in page.
    Now when we have page as mentioned above and with proper pooling parameters for AM (idle instance timeout - 5 minutes, minimum available pool size set to zero , pool polling interval - 7 min ) , we do a force GC for 3 - 4 times after every 10 min (we make sure we have no active users or sessions by this time). Now when we analyse the live heap dump we see AM , MasterVO1 , ChildVO1 and ChildVO2 remaining in heap.
    We have repeated the same testcase by removing child attributes in viewcriteria and with same AM pooling parameters - now when we analyse the heap dump , we dont see AM or any of the VO's residing in live heap.
    We are using the child attribute search feature heavily in our application - which is causing server to go out of memory for every 2-3 weeks.
    Please suggest on this - Can this be bug with ADF?.
    Thanks,
    Naresh
    Edited by: Naresh on Mar 20, 2013 9:37 AM

    Hi Ramdeep,
    Thanks for the reply - we dont have any custom code written on vo's or using vo's.
    It's simple case - just drag and drop vc as query region and vo's as tables , then we see this leak. Most Importantly we dont see this leak when we dont have childvo attribute in viewcriteria/query region.
    Any other clues ....
    Thanks,
    Naresh

  • Memory leak when transferring files Lion

    hi all, help   I'm experiencing a memory leak since upgrading to Lion when transferring shared files between my macbook pro and imac. This occures through ethernet (wireless/wired) and firewire 800. No other apps are open except activity montior and finder. I am trying to transfer about 100g of itunes music / video files and pictures. Time machine backups to my TC do not have this affect.
    When transfer starts the free memory slowly decreases whilst the inactive memory increases. Eventually the free memory drops below 10mg, active memory is approx 5-6gb and wired/active is about 2gb. Bascially as the free memory decreases the inactive memory increases however does not get realocated so the mac grinds to a halt and dies with lots of page outs etc.
    this only happens when trying to transfer files. I have tried whole folders and just small individual ones and noticed the same event. I am struggling to find the cuase of the problem - any ideas?
    mac os x 10.7.1
    processor 2.53 GHz Intel Core i5
    Memory 8 GB 1067 MHz DDR3
    cheers, Kevin

    I dont think you have a memory leak. I think the problem is the xml file is 1000000 records long and takes up too much memory. Even if you find a way to increase memory size, you are loading down the server too much for other people's applications to run. I suggest instead reading up on xml and learning how to read in only a few records at a time, processing it, and getting the next set of records to process. There are two methods to parse an xml file using an xml parser, one is to parse it all and put it in memory, the other is to process one record at a time (an xml book explains it better).
    However, I question why you have reports that are 1000000 records long. end-users cannot effectively use such records (you cant scroll through 1000000 records). I suggest finding a way to greatly decrease the number of records in each file such as by providing just the records a particular user needs to do his job and not all records. For instance, put a textfield on his screen to let him only fetch records within a certain date range.
    Lastly, I suggest putting your code in a try/catch/finally block where the finally block actually closes the objects. Example:
    finally{
    if(conn!=null)
    conn.close();
    }

  • Memory leak when transferring pdf...help needed

    Dear All,
    I'm a newbie in developing java app. I'm making a web based application in reporting using JSP. java 1.6.02, jasper report 204, i-report 2.0.0
    Client : OS : Win xp, memory 512MB
    Server : Tomcat 6.0
    DB Server : SQL Server 2005
    OS Server : Windows Server 2003, memory 1GB
    Report spec : .pdf based, with up to 1million record
    Here's the code :
    String query;
            try {
            String filereport = request.getRealPath("division/accounting/template/POReport.jrxml");
            InputStream input = new FileInputStream(filereport);
            Class.forName(odbcDriver);
            Connection conn = DriverManager.getConnection(odbcURL,username,passwd);
            ResultSet rset = null;
            CallableStatement cs = null;
            query = "{ call sp_tpo_list }";
              cs = conn.prepareCall(query);
              rset = cs.executeQuery();
            JRDataSource dataSource = new JRResultSetDataSource(rset);
            JasperDesign design = JRXmlLoader.load(input);
            JasperReport report = JasperCompileManager.compileReport(design);
            JasperPrint print = JasperFillManager.fillReport(report, null, dataSource);
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            JasperExportManager.exportReportToPdfStream(print, baos);
            response.setContentType("application/pdf");
            response.setContentLength(baos.size());
            ServletOutputStream sos;
            sos = response.getOutputStream();
            baos.writeTo(sos);
            sos.flush();
            rset.close();
            cs.close();
            conn.close();
            sos.close();
            baos.close();
            input.close();      
            catch (FileNotFoundException fe) {}
            catch (JRException jre) {}
            catch (ClassNotFoundException cnfe) {}
            catch (SQLException sqle) {} 
            catch (IOException ioe) {}I've already increase heap memory in Tomcat Manager -Xms 64Mb -Xmx 512Mb.
    But when i test with 1million record, out of heap memory error is coming out.
    When i test with 500.000 record, it work out, but only when 1 client access. More than 1 client, out of heap memory error generated by the system.
    How can this happen? How can i detect memory leaks occured in the program?
    And pls let me know if you see something is missing in the code above.
    Thank you

    I dont think you have a memory leak. I think the problem is the xml file is 1000000 records long and takes up too much memory. Even if you find a way to increase memory size, you are loading down the server too much for other people's applications to run. I suggest instead reading up on xml and learning how to read in only a few records at a time, processing it, and getting the next set of records to process. There are two methods to parse an xml file using an xml parser, one is to parse it all and put it in memory, the other is to process one record at a time (an xml book explains it better).
    However, I question why you have reports that are 1000000 records long. end-users cannot effectively use such records (you cant scroll through 1000000 records). I suggest finding a way to greatly decrease the number of records in each file such as by providing just the records a particular user needs to do his job and not all records. For instance, put a textfield on his screen to let him only fetch records within a certain date range.
    Lastly, I suggest putting your code in a try/catch/finally block where the finally block actually closes the objects. Example:
    finally{
    if(conn!=null)
    conn.close();
    }

  • Memory leak when pushView an popView

    Hello to community!
    I am having problems of memory leaks with an app I had build. After using it for 30-40 min it begin to go slow and slow.
    The app show images as a catalog, but when I push and pop the views my memory rise a lot.
    I think I am deleting all my oibjects setting them to to null and disposing all de bitmapdata that I use so I think that the problem should not be there.
    I have 3 views in my app menuView.mxml,categoriesView.mxml and productsView.mxml.
    My App begin in my pc (not in tablet) with TotalMemory: 47Mb and Private Memory : 88 MB
    After pushing and poping the views for 5 times I get TotalMemory: 61Mb and Private Memory : 101 MB
    Imagine if I do this for 20 times, all the app begin to go very slow in my Ipad or my Samsung Galaxy Tab.
    Why is this happening? I have no idea how to solve this.
    Thanks a lot!!
    I put some code below.
    Whe I am in menuView i use the following code to push the view from menuView to categoriesView
    protected function button3_clickHandler(event:MouseEvent):void
                    if((FlexGlobals.topLevelApplication.getIdClienteServidorCompraActual()!=null)&&(FlexGloba ls.topLevelApplication.getIdClienteServidorCompraActual()>0))
                        navigator.pushView(categoriesView);
    Whe I am in categoriesView i use the following code to push the view from categoriesView to productsView. In this view i have 3 button for each category.
    protected function buttonC1_clickHandler(event:MouseEvent):void
                    //Categoria general con todos
                    var ab:ArrayCollection =  getIdAmbienteServidor();
                    cleanMemory();
                    navigator.pushView(productsView, null);
    private function cleanMemory():void
                    result.splice(0);
                    result = null;
                    System.gc();
    Whe I am in productsView I use the following code to pop(I USE PUSH INSTEAD OF POP DUE TO DIFFERENT OPTIONS I HAVE) the view from productsView to categoriesView .
    protected function button1_clickHandler(event:MouseEvent):void
                    cleanMemory();               
                    navigator.pushView(menuView);        
    private function cleanMemory():void
                    if(image1 != null)
                        image1.source = "";
                        if(image1.bitmapData != null)
                            image1.bitmapData.dispose();
                    if(image2 != null)
                        image2.source = "";
                        if(image2.bitmapData != null)
                            image2.bitmapData.dispose();
                    if(result != null)
                        result.splice(0);
                        result = null;
                    if(result1 != null)
                        result1.splice(0);
                        result1 = null;
                    if(result2 != null)
                        result2.splice(0);
                        result2 = null;
                    dbConnection = null;
                    object1 = null;
                    object2 = null;
                    dataToSave = null;
                    cGreyImageSmallAsset = null;
                    cRedImageSmallAsset.bitmapData.dispose();
                    cRedImageSmallAsset = null;
                    cOrangeImageAsset.bitmapData.dispose();
                    cOrangeImageAsset = null;
                    cGreenImageAsset.bitmapData.dispose();
                    cGreenImageAsset = null;
                    cPinkImageAsset.bitmapData.dispose();
                    cPinkImageAsset = null;
                    cBlueImageAsset.bitmapData.dispose();
                    cBlueImageAsset = null;
                    cGreyImageAsset.bitmapData.dispose();
                    cGreyImageAsset = null;
                    cRedImageAsset.bitmapData.dispose();
                    cRedImageAsset = null;
                    cGreenImageSmall = null;
                    cOrangeImageSmall = null;
                    cPinkImageSmall = null;
                    cBlueImageSmall = null;
                    cGreyImageSmall = null;
                    cRedImageSmall= null;
                    cGreenImage = null;
                    cPinkImage = null;
                    cBlueImage= null;
                    cGreyImage = null;
                    cRedImage= null;
                    cOrangeImage= null;
                    System.gc();
    I load the images with.
    private function setImages():void
                    //var width:Number = FlexGlobals.topLevelApplication.width;
                    if(object1!=null)
                        //var widthImage1:Number = (width/2)-80;
                        //image1.width = widthImage1;
                        panelLeft.visible = true;
                        buttonLeftMore.visible = true;
                        image1.source = "file://" + File.applicationStorageDirectory.nativePath + "/b"+object1.idArchivo+"_500.jpg";
                        setObject1MainTexts();
                    else
                        image1.source = "";
                        panelLeft.visible = false;
                        buttonLeftMore.visible = false;
                    if(object2!=null)
                        //var widthImage2:Number = (width/2)-80;
                        //image2.width = widthImage2;
                        panelRight.visible = true;
                        buttonRightMore.visible = true;
                        image2.source = "file://" + File.applicationStorageDirectory.nativePath + "/b"+object2.idArchivo+"_500.jpg";
                        setObject2MainTexts();
                    else
                        image2.source = "";
                        panelRight.visible = false;
                        buttonRightMore.visible = false;
    Whe I am in categoriesView i use the following code to pop(I USE PUSH INSTEAD OF POP DUE TO DIFFERENT OPTIONS I HAVE) the view from categoriesView to menuView.
    protected function button1_clickHandler(event:MouseEvent):void
                    cleanMemory();
                    navigator.pushView(menuView);
    private function cleanMemory():void
                    result.splice(0);
                    result = null;
                    System.gc();

    Hello,
    I've the similar problem. I try to clean all objects, listeners and images. But i still have a memory leak.
    Do you found a solution, Richard ?
    Regards.

  • Photoshop CS6 memory leak when idle and nothing open

    Photoshop CS6 runs away with memory after being used and then going idle. If I open up PS and leave it, it will be ok but as soon as I open any file it will go up in memory usage (which is normal) but when I close all files and hide PS the memory will stay high never goes back down. When I close PS and re-open (no files open) again it idles at 300Mb memory but when I open a file then close it and then hide/idle PS it raises and stays around 1.25-1.5 GB if not more.
    I have tried to Purge All, and even hide all menus to no avail. I have even tried to close Suitcase (eleminiate any font issues) and still same problem. I am running PS bone stock, no extra plug-ins. 
    Any ideas on why it would be doing this would be greatly appreciated!
    My Computer:
    Photoshop 13.0.1
    MacBookPro
    OS 10.6.8
    CPU: 2.66 GHz Intel Core 2 Duo
    Mem: 4 GB 1067 MHz DDR3
    HD: 300GB (30GB Free)

    Photoshop is not supposed to free memory when you close documents -- that's normal, because the memory gets reused.
    Yes, opening a file makes the memory usage go up - because space is needed for the document and it's window.
    None of what you said describes a leak, and sounds like perfectly normal behavior.

  • Huge memory leak when closing PDF from Hyperlink

    I was wondering if anyone else has experienced this issue with Adobe Reader 11.0.10 on Windows 7 64bit:
    1. I have a list of hyperlinks in an Access Table to certain PDF files on a local network folder.
    2. Clicking the hyperlink opens the corresponding PDF.
    The PDF file opens just fine, and renders normally. The issue is when I attempt to close the PDF. This results in an instant Memory leak that will grow to 4GB in under 10 seconds. System crashes completely. I can reproduce the crash in Safe Mode as well. I am able to open/close the PDF from its source location normally without incident. Clean Uninstall/Reinstall produces the same results.
    Downgrade to Adobe 10 fixes the problem completely. I can reproduce the problem on all computers on my network (all running windows 7 32bit or 64bit) by upgrading to Reader 11.0.10.
    I prefer to keep my software updated to prevent vulnerabilities, so any help would be appreciated.

    That is very strange because it is a 32-bit program and cannot (according to popular wisdom) grow over 2 GB. Also, if it were to reach 2 GB it would simply crash, not break the system.
    Do you have a screen shot showing the 4 GB? There might be clues there what is happening.

Maybe you are looking for