Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • memory leak using frames - do not use frames

    I did a simple test(test3.jsp). The conditions to do this test is wblogic9+windows2003 server and Version 6.0 IE.

    each time when i viewd test3.jsp on IE,the memory of my computer whould be increased by 3M

    for example,when I started test,the memory was 300M,after i pressed F5 10 times to refresh test3.jsp,the memory whould be increased to 330M. This situation remained until I closed all the IE windows.

    why did this happen?

    and Could you please tell how to release the memory of computer?

    test3.jsp code :
    <%@page contentType="text/html; charset=gb2312" language="java"%>
    <%@ taglib uri="isomorphic" prefix="isomorphic" %>

    <html>

    <head>
    <title>smartclient test1</title>
    <meta http-equiv="Pragma" content="No-Cache">
    <meta http-equiv="content-type" content="text/html;charset=gb2312">
    <isomorphic:loadISC />
    </head>

    <body CLASS=normal STYLE="overflow:hidden">


    </body>
    </html>

  • #2
    Hi Elietian,
    These results are interesting - we find that on a completely fresh Internet Explorer browser, with no other browser windows open, loading SmartClient for the first time takes about 35 - 40 M (for example 35764K) of memory - not the 300 M that you're seeing.
    We're getting this figure from the Windows Task Manager, looking at the iexplore.exe process in the processes tab.

    Can you confirm that this 300M of memory usage figure is accurate for the first time loading SmartClient in a new Internet Explorer instance (with no other browser windows open)? And, how are you determining this memory usage?

    Thanks

    Comment


    • #3
      i mean when i open my computer my memory is 300M.
      not loading SmartClient first time.

      btw sorry about my english,i know its not very well. hope u can understand.

      Comment


      • #4
        the problem is each time when i press f5 to refresh the jsp , the memory increase 4M ,
        is that something wrong with javascript memory leaks?

        do i need to set html dom object to null which was created by smartclient api ,and recycle garbage?
        thank u !
        Last edited by elietian; 10th May 2007, 22:04.

        Comment


        • #5
          Hi Elietian,

          Typically you will not need to worry about memory management when writing SmartClient applications.
          JavaScript developers have no direct control over the system memory used by the browser -- instead, whenever JavaScript objects go out of scope, and whenever a page-reload occurs, all objects should be released from memory, so the browser is free to reclaim the memory used by them.

          The increase in memory usage you're seeing on 10 page reloads is a result of how the browser natively manages memory -- in other words when it reclaims the memory released by the objects which have gone out of scope.
          If you keep reloading the page, you should find the memory usage does not continue to increase forever - it will reach a plateau and level off.
          (We are not aware of any "true" memory leaks with Page reloads when SmartClient is loaded. Of course if you're seeing something else in your environment, let us know and we can investigate further).

          If this continues to be a concern for you, or you start to run into performance issues using SmartClient, please let us know and we'll be happy to make some suggestions based on your application.

          Comment


          • #6
            thanks a lot !

            Comment


            • #7
              about the memory still can not be released

              i made a page(smart_main.jsp) with framework of SmartClient ,the smart_main was used by HTMLPane to insert two pages

              (smart_lisft.jsp and wf_assignment_view.jsp)
              at first, i start my computer (no any ie window) my memory is 420M ,when i open a window to view the welcome.jsp page(this

              page has a url which can open a new window to smart_main.jsp)
              the memory is 453M,when a click that url and open smart_main.jsp,my memory is 488M,it increased 35M.
              how ever when i close smart_main.jsp
              the memory is 481M(i was confused, i thought it should be 453M)
              if i close welcome.jsp and all the smart_main.jsp,the memory is 420M
              when i open welcome.jsp and keep on opening and closing smart_main.jsp ,the memory increase unceasingly
              and in this condition i found its more and more hard to have a visit at smart_main.jsp(too lag)
              is that something wrong with my code?plz check it out,tks!

              Comment


              • #8
                smart_main.jsp code:
                Code:
                <html>
                <head>
                <title>收文管理</title>
                <meta http-equiv="Pragma" content="No-Cache">
                <meta http-equiv="content-type" content="text/html;charset=gb2312">
                
                <SCRIPT>window.isomorphicDir='/isomorphic/';</SCRIPT>
                <SCRIPT SRC="/isomorphic/system/modules/ISC_Core.js?isc_version=5.6.js"></SCRIPT>
                <SCRIPT>isc._lastModule='Core';</SCRIPT>
                <SCRIPT SRC="/isomorphic/system/modules/ISC_Foundation.js?isc_version=5.6.js">
                </SCRIPT><SCRIPT>isc._lastModule='Foundation';</SCRIPT>
                <SCRIPT SRC="/isomorphic/system/modules/ISC_Containers.js?isc_version=5.6.js"></SCRIPT>
                <SCRIPT>isc._lastModule='Containers';</SCRIPT>
                <SCRIPT SRC="/isomorphic/system/modules/ISC_Grids.js?isc_version=5.6.js">
                </SCRIPT><SCRIPT>isc._lastModule='Grids';</SCRIPT>
                <SCRIPT SRC="/isomorphic/system/modules/ISC_Forms.js?isc_version=5.6.js"></SCRIPT>
                <SCRIPT>isc._lastModule='Forms';</SCRIPT>
                <SCRIPT SRC="/isomorphic/system/modules/ISC_DataBinding.js?isc_version=5.6.js">
                </SCRIPT><SCRIPT>isc._lastModule='DataBinding';</SCRIPT>
                <SCRIPT SRC="/isomorphic/skins/SmartClient/load_skin.js?isc_version=5.6.js">
                </SCRIPT>
                
                </head>
                
                <body CLASS=normal STYLE="overflow:hidden">
                
                <form name="_MainForm" action="/oa/recvfile/smart_main.jsp" method="post" >
                <input type="hidden" name="_V$AccessMode" value="Openform">
                
                <table>
                <tr>
                <td>
                <script>
                 isc.HTMLPane.create({
                        ID:"leftPage",
                        showEdges:true,
                        contentsURL:"/oa/recvfile/smart_left.jsp",
                    	width:"100%",
                    	height:"100%",
                	showResizeBar:true,        
                        contentsType:"page"
                    });
                 isc.HTMLPane.create({
                        ID:"rightPage",
                        showEdges:true,
                        contentsURL:"/oa/recvfile/wf_assignment_view.jsp?OpenForm&$AppUnitNo=11779233472290.17887994342721625",
                    		width:"100%",
                    		height:"100%",        
                    		showResizeBar:true,
                        contentsType:"page"
                    });    
                isc.HLayout.create({
                    ID:"pageLayout",
                    width:"100%",
                    height:"100%",
                    layoutMargin: 0,
                    membersMargin: 0,    
                    members:[
                        isc.SectionStack.create({
                            ID:"leftSideLayout",
                            width:190,
                            height:"100%",
                            showResizeBar:true,
                            visibilityMode:"multiple",
                            animateSections:true,
                            sections:[{title:"收文管理",autoShow:true,items:[leftPage]}]
                        }),
                        isc.SectionStack.create({
                            ID:"rightSideLayout",
                            backgroundColor:"white",
                            visibilityMode:"multiple",
                            animateSections:true,
                            sections:[{title:"待办",autoShow:true,items:[rightPage]}]
                        })
                    ]
                });
                
                
                </script>
                </td>
                </tr>
                
                </table>
                </form>
                
                </body>
                </html>

                Comment


                • #9
                  Hi elietian,

                  You are getting a memory leak because you are using IFrames via contentsType:"page". From the docs for contentsType:

                  contentsType:"page" should only be used for controlled HTML content, and only when such content cannot be delivered as an HTML fragment instead (the default). To dynamically load SmartClient components, use ViewLoader, never this mechanism.
                  So, you've just run into one of the reasons why we say you should never use contentsType:"page" to load SmartClient components :)

                  Some of the other reasons include:
                  • each additional frame multiplies the memory footprint and reduces speed
                  • having multiple frames prevents drag and drop between components in different frames
                  • modality handling (eg modal dialogs) doesn't automatically take into account multiple frames (and when you consider tabbing order, nested modality and other issues, you'll see it would be ridiculously complicated)
                  • inter-frame communication triggers several browser bugs: memory leaks, performance issues, intermittent crashes in some browsers, inconsistencies in basic JavaScript operators such as "typeof", and problems with form focus handling in IE, among many other bugs

                  These problems aren't specific to SmartClient, they happen with Ajax frameworks in general as well as other RIA technologies.

                  Using a ViewLoader in place of those HTMLPanes will remove this problem, simplify and speed up your application. Better yet, follow the recommended SmartClient Architecture and preload as many views as possible.

                  Comment


                  • #10
                    thank u for u help
                    in chinese we say 谢谢

                    Comment


                    • #11
                      is there a way to release memory if i add a javascript what will working for release memory in onunload event when i close ie explorer ?

                      i have no other scheme in my project,only to use iframe.
                      or may be u can find another way with using iframe but no too much memory increased.

                      Comment


                      • #12
                        Even if we worked around the memory leak (which is complicated) you would still have 4 other "showstopper" problems by my count.

                        What is forcing you to use iframes? We can probably figure out another approach.

                        Comment


                        • #13
                          memory leak using frames - do not use frames

                          for my case file upload doesn't work properly ,So I'm implementing with struts 2 and same loading with iframe, can you please tell me the way to do this.

                          Comment

                          Working...
                          X