How to minimize memory leaks when auto-refreshing datasets

I have a page with two Spry datasets, each of which has a
loadInterval of 30 seconds to 1 minute. Looking at the Windows Task
Manager, I see that Firefox 3 consumes 500,000kb of Working Set
memory after about 2.5 hours of no activity (other than leaving the
page open). When first loaded, Firefox was using 130,000kb, so
that's an increase of 370,000kb. Similarly, IE 7 increases from
73,000 to 130,000 in the same time period.
Is there anything that I can do programmatically to minimize
or eliminate this problem?

Thanks for the response. I need to refresh frequently because
the application is a kind of "dashboard" to show the status of
certain activities; when one of the activities occurs, the mySQL
database reflects the change, and I want the Spry dataset to show
the change to the user in more or less "real time."
I am a little unclear about your last two suggestions. When
you say, "you should generate XML files first then use it as
dataset instead directly your server side as xml on dataset url" do
you mean that I should NOT create the xml for the dataset
dynamically using a php script? (I am creating it dynamically
because that's the only way I know to get "fresh" up-to-the-moment
data. Am I missing something? And why does it matter HOW the xml is
created?
Also, can you explain how you're suggesting that I use the
javascript timeout with Spry SetURL(). I like the idea of trying to
empty the dataset, but don't understand how to implement it
(concenptually).
Thanks!

Similar Messages

  • FireFox won't auto-refresh specific site, other browsers do. How can I get FF to auto-refresh?

    I have a Help Desk application (everything HelpDesk) with a web interface. I keep my queue screen open so I can see new tickets come in and check status of existing tickets. FireFox does not auto-refresh this queue page so that new items or status changes show up. The page must be manually re-loaded in FireFox. However, other browsers (Chrome, IE, Safari) auto-refresh the queue page just fine. How can I get FireFox to auto-refresh this page?

    See:
    *Firefox/Tools > Options > Advanced > General : Accessibility : [ ] "Warn me when web sites try to redirect or reload the page"
    The setting in "Tools > Options > Advanced > General" is meant as an accessibility feature, as you can see by the label of that section, so that people with disabilities or people who use screen readers do not get confused and is not meant as a safety protection to stop redirecting.
    See also:
    *https://support.mozilla.com/kb/Options+window+-+Advanced+panel#General_tab
    *http://kb.mozillazine.org/accessibility.blockautorefresh
    *http://kb.mozillazine.org/Accessibility_features_of_Firefox

  • 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

  • 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.

  • 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. 

  • How to make session invalid when user refresh the page?

    How to make session invalid when user refresh the page?

    I have a <form> in a JSP file that has another JSP file as an action.
    I have main.jsp that has <form> with action.jsp file as an action.
    Now when I submit the <form>, request forwarded to action.jsp and it will take the action. But this file is taking so long, hence user refresh the page again and again, hence duplicate request processing is occuring.
    I want to prevent this.

  • 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 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 running in database

    I am somewhat new to java and very new to java in the db. I just ran into a problem with what appears to be a memory leak. I have a substantial java program used to parse XML files. I developed this app in jDeveloper and for testing purposes created a method that would connect to the database so that I could run the app from jDeveloper instead of having to deploy it everytime i needed to run it. When deployed the application uses the existing connection to connect to the db.
    I am running Oracle 9i on a windows 2k machine.
    When I run the application through jDeveloper the javaw.exe process takes up roughly 20mb of RAM and doesn't increase. I also watched the oracle.exe process and there was little to no increase in the RAM that it was using.
    When deployed to a db and run through a java stored procedure the RAM used by the oracle.exe process sky rockets, jumping from 70mb to 139mb at about 2mb per second.
    Hopefully this will make some sense to someone as posting code would be somewhat difficult considering the size of the project. Is there something I'm missing? I've tried calling the garbage collector explicity but it has had no effect. I have made sure that all my cursors, statements, resultsets are closing. I have a number of Vecotors which are all being de-allocated(as far as i can tell). Are there any known issues with the garbage collector in a 9i DB?
    Thanks
    Butch Wesley

    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

  • 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.

  • Memory leak when browsing through records

    Hello,
    I have a problem with any page containing the component related to each other on three or more levels. (1st level ADF Table, 2nd level ADF Table and 3rd level ADF Form)
    By navigating through the records of the first level, there is refreshment at other levels (using partial triggers), but suddenly there is loss of memory (memory leak) for components of type Select One Choice.
    Precisely, the problem appears when browsing another Show Detail Item in the same page.
    Screenshot showing the Data Control in my page: [http://www.infotun.net/usersimages/1/adf/structure.jpg]
    Capture screen representing the initial state where all is well: [http://www.infotun.net/usersimages/1/adf/initial.jpg]
    Capture screen representing the final state after memory loss: [http://www.infotun.net/usersimages/1/adf/final.jpg]
    I'm using JDeveloper Studio 11.1.1.2.0
    JDK: 1.6.0_14
    Operating System: Windows 7.
    Any help/advice is highly appreciated !
    Thanks
    Edited by: InfoTun on 10 juin 2012 16:22
    Edited by: InfoTun on 10 juin 2012 16:26

    Hi,
    the screenshot does not indicate a memory leak. Memory leaks show by the server memory consumption that leads to slow performance or stale applications. Your issue seems to be different from that and doesn't really explain in the screen shots. If you have a support contract then customer support is the recommendation I like to give
    Frank

  • Memory Leak on Applet Refresh in IE

    Hi All,
    This is really strange, if you have launched an java applet in IE and hit refresh, the the memory consumed by IE increses.Ideally speaking the consumed memory in task manager by IE with applet should show same if you hit refresh.But it grows.There is a memory leak.
    There was a bug [http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4894522] filed and claims to be fixed in 1.4..well i dont see it fixed in 1.6 either.
    Any thoughts..??
    Ex: First launch 45MB is being by applet ..hit refresh it goes to 80MB...and this goes untill a point and the incrementation of memory consumed becomes smaller and control becomes very slow.
    Thanks,
    Ranjitha

    More likely a bug in your applet. Not that there's not bugs, but more often than not, the fault is yours, not Java's.
    That's a whole lot of memory usage. That suggests that you are loading up a bunch of stuff, then holding onto it in the applet reference, maybe some static fields, then creating a whole new set of objects the second time.
    Static fields are not discarded, nor are classes unloaded (or technically because classes are not unloaded), when the browser is refreshed. So if you don't dispose of things, they may linger.
    Of course, resetting a static field should make the old objects go out of scope and eligible for GC.
    So maybe some explanation of what you're doing in your applet would go a long way towards figuring it out.

  • How to determine memory leaks?

    I tried in XCODE, the RUN/ Start with Performance TOol / and tried out the various options. I was running my app and looking to see if it would report increasing memory use but it seemed to be looking at my total system (i was running under the simulator). In general what is the recommended procedure for determining memory leaks, which tool to use, and what tracing can i use?
    How does one look at the retain count of an object? are there system routines that have knonw leaks?

    You took the right path. Once instruments comes up select the Leaks tool. Turn off automatic leak detection. In your app, start off at some known state, do something, and come back to the known state and check for leaks. For instance start off in a view, do something that brings up another view then come back to the original view and check for leaks. Leaks will show you if you leaked. Since you took a very deterministic path then checked it should be straight forward to go to the code and find / fix the leaks. Leaks shows you where the code where the leak was generated.

Maybe you are looking for