Go Back   SmartClient Forums > Technical Q&A
Wiki Register Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 9th May 2007, 20:11
elietian elietian is offline
Registered Developer
 
Join Date: May 2007
Posts: 11
Default 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>
Reply With Quote
  #2  
Old 10th May 2007, 10:05
Isomorphic Isomorphic is online now
Administrator
 
Join Date: May 2006
Posts: 37,712
Default

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
Reply With Quote
  #3  
Old 10th May 2007, 17:12
elietian elietian is offline
Registered Developer
 
Join Date: May 2007
Posts: 11
Default

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.
Reply With Quote
  #4  
Old 10th May 2007, 21:27
elietian elietian is offline
Registered Developer
 
Join Date: May 2007
Posts: 11
Default

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 at 22:04..
Reply With Quote
  #5  
Old 11th May 2007, 16:10
Isomorphic Isomorphic is online now
Administrator
 
Join Date: May 2006
Posts: 37,712
Default

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.
Reply With Quote
  #6  
Old 13th May 2007, 17:16
elietian elietian is offline
Registered Developer
 
Join Date: May 2007
Posts: 11
Default

thanks a lot !
Reply With Quote
  #7  
Old 15th May 2007, 23:46
elietian elietian is offline
Registered Developer
 
Join Date: May 2007
Posts: 11
Default 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!
Reply With Quote
  #8  
Old 15th May 2007, 23:47
elietian elietian is offline
Registered Developer
 
Join Date: May 2007
Posts: 11
Default

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>
Reply With Quote
  #9  
Old 16th May 2007, 11:12
Isomorphic Isomorphic is online now
Administrator
 
Join Date: May 2006
Posts: 37,712
Default

Hi elietian,

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

Quote:
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.
Reply With Quote
  #10  
Old 16th May 2007, 17:12
elietian elietian is offline
Registered Developer
 
Join Date: May 2007
Posts: 11
Default

thank u for u help
in chinese we say 谢谢
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search


© 2010,2011 Isomorphic Software. All Rights Reserved