JSP - HTTP Session memory leak !!!

Hi there,
Another problem with JSP implementation of the framework !!!
I just added a debugging option to the jsp that show me the session.getValueParameters()
with their value.
My question is why or when are the rowkeys flush out of the session environment and if it's not this the bug that causes a java.lang.OutOfMemory when navigating in big result sets in an Master-Detail View.
Any answer from JDev Team will me very much appreciated.
TIA,
Seb

Hello,
You can modify the RowSetBrowser.java file to release all the detail keys after each master record is navigated. You need to clear the keys at the top of the render method as follows:
Hashtable keys = getKeys();
// assume that all keys need to be removed, we only support navigation through
// one screenfull of row keys
keys.clear();

Similar Messages

  • OSMF HTTP Stream Memory Leak

    Hello,
    When you stream Media with the help of f4m,
    one segment is downloaded and played back.
    But after playback, they remain in RAM and accumulate!
    Is there a way that those played parts are automatically removed from Memory like it's down with a real RTMP stream ?
    So what does that mean?
    If you stream a live event which lasts over several hours, the streamed data will accumulate in Memory and force a crash.
    This will especially happen on systems with a low amount of memory (netbooks, mobiles, older pc's or even desktiops which use the RAM for more than streaming...)
    Regards
    Marc

    Hi,
    Thank you for the information, I raised an issue for you at http://bugs.adobe.com/jira/browse/FM-1286. We'll prioritize it and investigate it accordingly.
    It might be caused by OSMF or even by Flash Player.
    Please feel free to subscribe to the bug so you'll track it easier. Also, if you happen to find other problems, please use the bugtracker to report it.
    S.

  • Memory leak with jsp and beans

    The application we have created has one particular page that is designed to stay up in the browser and refresh with new information from database queries once every 60 seconds. Running with Tomcat3.2.1 and IE5.5
    The problem is that the memory usage of java.exe continues to grow until the machine crashes from out of memory. It does take more than 24 hours to crash.
    Things I have tried to do to track down the problem or eliminate the problem.
    - I have explicitly set the scope of the beans to "page"
    - I have watched the DatabaseAccess.class (the beans are all extended from this class) and put in code to watch how many instantiations of the class are made and subsequently garbage collected. This appears to be where the memory leak may reside - hundreds of instantiations from some other source than the page I am displaying.
    - the top frame makes database queries for security and display of a menu system dependant upon security clearance. It does not set any time for refresh (refresh == 0). Nor does it explicitly set a scope for the beans.
    - I have run a different jsp engine to see if this was directly related to Tomcat - same problem with resin2.0.0
    The main jsp page that is in the bottom section of the page has the following code:
    ** only the relevant lines are included here
    <%@ include file="../../common.jsp" %>
    <%
         refresh=60;
    %>
    <head>
    <%@ include file="../../meta_head.jsp" %>
    </head>
    <body bgcolor="#FFFFFF" text="#003399" link="#660099" vlink="#990099" alink="#006666" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <%@ include file="../../access.jsp" %>
    <%@ include file="../../page_title.jsp" %>
    <jsp:useBean id="Line" class="jsp.Line" scope="page" />
    <jsp:useBean id="Machine" class="jsp.Machine" scope="page"/>
    <jsp:useBean id="Alarm_log" class="jsp.Alarm_log" scope="page"/>
    contents of meta_head.jsp
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <META HTTP-EQUIV= "expires" content = "0">
    <META HTTP-EQUIV="Pragma" CONTENT="no_cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache" forua="true">
    <META NAME="robots" content="NOINDEX,NOFOLLOW">
    <%
    if (refresh > 0)
    %>
    <meta http-equiv="Refresh" content="<%= refresh %>">
    <%
    If anyone has some suggestions on how to trap this memory leak, it would be terrific. Or, some other things to try to stop the instantiation of the DatabaseAccess object (perhaps setting the scope of the beans in the header to "session" or "application"?).
    Thanks in advance.
    Roberta

    jsp:useBean tags scope declaration :
    page = Create a new instance on each load.
    session = Load instance from the session, if not there, create one
    application = Load instance from the ServletContext, if not there, create one.
    Not sure how you are populating the data variables, but make sure you are closing all ResultSet, (Prepared)Statement, and Connection objects.

  • In-memory replication of http session is not working in BEA7 cluster

              Hi everyone,
              I have 3 managed servers in Bea7.0 SP4 in a cluster. The client requests are sent
              through apache web server. I have given cluster address as URL in httpd.conf of
              apache server which sends the client requests for dynamic pages such as JSPs and
              servlets to the weblogic cluster.
              Load balancing is working fine. I ensured this from the log files of all the 3
              servers. All the 3 servers are getting different client requests and thus load
              balancing is working.
              Now, I wanted to achieve Fail-over. I do not think that i should use proxy plug-in
              for this. I feel the cluster itself will handle fail-over provided i make the
              http session as memory replicated.
              I updated the weblogic.xml with the following entry :
              <session-descriptor>
              <param-name>PersistentStoreType</param-name>
              <param-value>replicated</param-value>
              </session-param>
              </session-descriptor>
              I guess this is sufficient to make the http session as cluster aware.
              But when I shutdown server1, the user connected to server1 will be kicked out
              of the session and come to login page through server2 or server3 which are running
              fine.
              Could anyone help me to achieve http session as cluster aware. Does it indicate
              that I have to go for WLS proxy – HttpClusterServlet to achieve fail over for
              http session ?
              BTW, for your info, i am using setAttribute() and getAttribute() while manipulating
              the session.
              thanks in advance.
              

              Hi Ryan,
              Thanks for ur valuable input.
              I can see failover working.
              But, I can not continue with the same session in my application.
              I printed session Ids before and after failover, I found both are different.
              I guess session replication is a responsibility of weblogic/apache plugin.
              If not please let me know which all settings I should do to make failover working?
              Thanks again.
              Plad
              "ryan upton" <ryanjupton at learningvoyage dot com> wrote:
              >Plad,
              >
              >Are you trying to gracefully shut down the server? If you are then the
              >problem that you say you can't identify is simply the server's default
              >behavior which is to wait for all non-replicated sessions to be dropped
              >or
              >timed out before killing the process. Try forcing the shutdown: kill
              >-9 the
              >PID or CTRL-C if you started the server from the command line. You can
              >also
              >check the ``Ignore Sessions During Shutdown" checkbox under the server's
              >control tab in the admin console, this should allow you to shut down
              >gracefully without waiting for session timeout. BTW your sequence is
              >off
              >in #5 below, the replication doesn't occur upon failure, the replication
              >has
              >already happened once you created the session object on the first server,
              >I
              >think maybe you're confusing replication with failover.
              >
              >~RU
              >
              >"Plad" <[email protected]> wrote in message
              >news:[email protected]...
              >>
              >> Hi,
              >> I have 2 managed servers in a cluster.
              >>
              >> 1. I have got a DNS name configured which maps to these 2 managed server's
              >IP
              >> addresses.
              >> 2. I can browse my site using this DNS name.
              >> In HTTPD.conf I have :
              >>
              >> ServerName dev.a.b.net
              >>
              >> <IfModule mod_weblogic.c>
              >> WebLogicCluster 10.1.38.232:7023,10.1.34.51:7023
              >> MatchExpression *.*
              >> </IfModule>
              >>
              >> LoadModule weblogic_module modules/mod_wl_20.so
              >>
              >> 3. I have adeded session descriptor in weblogic.xml , also enabled
              >proxy
              >plugin
              >> in weblogic console.
              >>
              >> 4. I tested accessing my application using DNS url after shutting down
              >alternatively
              >> each manaed server. I can access application.
              >>
              >> 5. Now, problem comes when I access a managed server1 , keeping server2
              >down.
              >> I am able to access my application.
              >> Now, I start the server2.
              >> (Here I am supposing that replication should occur)
              >> Then I am shutting down server1.
              >> But, this time the server log shows me following:
              >>
              >>
              >> 9:58:51 AM GMT+05:30 NOTICE Web application(s) chlist still have
              >non-replicated
              >> sessions after 2 minutes of initiating SUSPEND. Waiting for non-replicated
              >sessions
              >> to finish.
              >> 10:00:51 AM GMT+05:30 NOTICE Web application(s) chlist still have
              >non-replicated
              >> sessions after 4 minutes of initiating SUSPEND. Waiting for non-replicated
              >sessions
              >> to finish.
              >>
              >> I am unable to make out where the problem is?
              >> Can it be a problem of Liecense? Is there any specialcluster liecense
              >for
              >weblogic8?
              >>
              >> Hoping to get replies.
              >> Thanx.
              >> Plad
              >>
              >> "ryan upton" <ryanjupton at learningvoyage dot com> wrote:
              >> >See my reply to your first post, but I've also added a few comments
              >here.
              >> >
              >> >"jyothi" <[email protected]> wrote in message
              >> >news:[email protected]...
              >> >>
              >> >> I guess someone from bea support team only can answer both your
              >question
              >> >and mine.
              >> >> As per my knowledge, we do not need to do any setup at Apache
              >side
              >> >regarding
              >> >> cluster other than mentioning cluster address as URL while
              >contacting
              >> >WLS
              >> >> from apache.
              >> >>
              >> >> I hope someone from Bea, will help us. I do not think that we
              >> >go for
              >> >WLS
              >> >> proxy plug-in using HttpClusterServlet for making session replication.
              >> > I
              >> >strongly
              >> >> feel that the cluster itself be able to manage the fail-over of
              >> >http
              >> >sessions
              >> >> provided we put the entry "PersistentStoreType" in weblogic.xml
              >> >regarding
              >> >> the session replication.
              >> >>
              >> >
              >> >The cluster does handle the management of Sessions. The clustered
              >> >applications still create the Session objects and the cluster manages
              >> >them
              >> >as per your deployment descriptor settings (replicated, JDBC, File)
              >however
              >> >the proxy has to be aware of which server the client has an affinity
              >> >for
              >> >(only with replicated sessions) and it does that by reading a cookie
              >> >passed
              >> >back from the server that handled the initial request and created
              >the
              >> >primary session object. The proxy has a list of both the primary
              >and
              >> >secondary server locations from this cookie that it can use to failover
              >> >the
              >> >request if the primary server fails. Clusters _DO NOT_ failover nor
              >> >do they
              >> >load balance, that's the job of your proxy, whether you're using the
              >> >HTTPClusterServlet, WLS Plug-in or a more sophisticated hardware load
              >> >balancer like Big IPs F5
              >> >
              >> >> jyothi
              >> >>
              >> >
              >> >~RU
              >> >
              >> >
              >>
              >
              >
              

  • Memory leak in JSP

    Hi everbody !
    We got big problems with memory on JSP. When the JPServer (TomCat, WebLogic or Jrun) is running and regular Http browser is running the memory still grows up and never go down. Even if you close the IE or NetScape it dosn't help. The only solution we found is to reset Web server but for furter use is not an option. Has anybody simiar problem and knows the resolution for it.
    Thx for any help
    Peter

    What version of JDK are you running? I use an in-house compile of JDK 1.3.1's Server VM (I won't go into the details, but Sun's release JDK's for Windows are built with a questionable version of MSVC that has known bugs relating to memory allocation and other things) which I have had resolve memory leak issues. I'm running JRun 3.1 on Windows 2000 with a dual-processor setup with no memory leak issues, and we have a project running JSP, servlets and EJBs with no problems.
    Could you give some more details on your configuration?
    - Kirk

  • Use HTTP Session to pass Object from Web Dynpro for Java to JSP page

    Is it possible to get a handle on the HTTP Session object from within a Web Dynpro application? I want to place a Java object in there that can be retrieved by a JSP page.
    Thanks in advance.

    Hi Tom Cole,
       You can try this. i am not sure if this will work or not.
    HttpServletRequest request = ((IWebContextAdapter) WDWebContextAdapter.getWebContextAdapter()).getHttpServletRequest();
    You can also try this.
    IWDRequest mm_request = WDProtocolAdapter.getProtocolAdapter().getRequestObject();
    HttpServletRequest request = (HttpServletRequest)mm_request.getProtocolRequest();
    IWDRequest basically wraps the HttpServletRequest. if you are using NW04s then the getProtocolRequest() may not be available.
    Regards,
    Sanyev

  • HTTP Sessions tracking using in-memory session replication

              I am using wls5.1. I have a situation where the "Java Heap size
              used" exceeds 100%, then it drops down to maybe 20% (after garbage
              collection). What happens to the active Http sessions when using
              in-memory session replication with persistance set to false.
              Are the sessions written to disk? If so, where?
              Are the sessions, before the garbage collection, still active?
              

    Also looks like either your session invalidation time is too high or your
              heap size is too small. Make sure you tune either of this paramater
              properly.
              Viresh Garg
              Principal Developer Relations Engineer
              BEA Systems
              Prasad Peddada wrote:
              > Replicated session data is never written to disk. I dont' understand
              > your second questions. If the session is active and if GC kicks in it
              > won't delete the object since the servlet engine has reference to that
              > session object.
              >
              > Make sure you never swap and your application has enough heap.
              >
              > -- Prasad
              >
              > chris mckinnon wrote:
              >
              > > I am using wls5.1. I have a situation where the "Java Heap size
              > > used" exceeds 100%, then it drops down to maybe 20% (after garbage
              > > collection). What happens to the active Http sessions when using
              > > in-memory session replication with persistance set to false.
              > > Are the sessions written to disk? If so, where?
              > > Are the sessions, before the garbage collection, still active?
              >
              > --
              > Cheers
              >
              > - Prasad
              

  • HTTPS HTTP SESSION JAVABEAN JSP

    Hello all.
    i work in http session...after i redirect in https(login.jsp)
    in JavaBean for Login.jsp try get connection with all object or JavaBeans from last http session ...but i cannot do it.
    Where my problem ?
    Help me please.

    i think u want to redirect from login jsp page to another page with request object.
    try response.sendRedirect("yourjspfile.jsp");

  • JRC and JSP memory leak...

    Hi, I have an web application with Crystal Reports integrated via the JRC. However, I have a memory leak within the application. I have narrowed it down to the JSP which uses JRC code. The NetBeans profiler shows a memory leak, it appears to be a leak with the JRC code with the class (com.crystaldecisions.reports.exporters.format.page.pdf.pdflif.f). I have try changing the <timeout> tag in CRConfig and using .dispose() and .close(), all to no avail. This error may jepordize our latest production release... Please, help...

    Best to download 2.0 and install all patches and test again. If not resolved then post your issue with details and code samples.

  • Memory leak puzzle

    Hello guys,
    I'm having a very, very difficult time debugging this memory leak on my server. I'm pretty sure it's related to berkeley DB XML, bu I just couldn't prove this in numbers.
    My server: Debian GNU/Linux 2.4.27-2-386 #1 Wed Aug 17 09:33:35 UTC 2005 i686 GNU/Linux, 512 MB of RAM, Pentium 4-class processor.
    Here's the behaviour. I start Tomcat 5.5.15, the application is loaded, current memory status:
    delegaciainterativa:~# free -m
    total used free shared buffers cached
    Mem: 440 346 94 0 14 282
    -/+ buffers/cache: 49 391
    Swap: 909 4 905
    So, I've got 94 MBs of free memory. Now, here's this JSP I'm running:
    <%@ page language="java" %>
    <%@ page session="true" %>
    <%@ page import="br.gov.al.delegaciainterativa.admin.*"%>
    <%@ page import="br.gov.al.delegaciainterativa.controles.*"%>
    <%@ page import="br.gov.al.delegaciainterativa.admin.areas.*"%>
    <%@ page import="br.gov.al.delegaciainterativa.controles.BdbXmlAmbiente"%>
    <%@ page import="java.util.*"%>
    <%@ page import="javax.servlet.RequestDispatcher"%>
    <%@ page import="com.sleepycat.dbxml.XmlContainer"%>
    <%@ page import="com.sleepycat.dbxml.XmlDocument"%>
    <%@ page import="com.sleepycat.dbxml.XmlException"%>
    <%@ page import="com.sleepycat.dbxml.XmlIndexDeclaration"%>
    <%@ page import="com.sleepycat.dbxml.XmlIndexSpecification"%>
    <%@ page import="com.sleepycat.dbxml.XmlQueryContext"%>
    <%@ page import="com.sleepycat.dbxml.XmlQueryExpression"%>
    <%@ page import="com.sleepycat.dbxml.XmlResults"%>
    <%@ page import="com.sleepycat.dbxml.XmlTransaction"%>
    <%@ page import="com.sleepycat.dbxml.XmlUpdateContext"%>
    <%@ page import="com.sleepycat.dbxml.XmlValue"%>
    <%@ page import="com.sleepycat.dbxml.XmlUpdateContext"%>
    <%@ page import="com.sleepycat.dbxml.XmlQueryContext"%>
    <%@ include file="config.jsp"%>
    <%!
         final String _grupoPagina = "visualizaLogsUsuario";
    %>
    <font face="verdana" size="1">
    <%
              HttpSession sessao = request.getSession(true);
              BdbXmlAmbiente bdbxmlAmbiente = new BdbXmlAmbiente();
              XmlContainer container = bdbxmlAmbiente.abrirContainer(Config.getNomeContainerBO());
              String fullquery = "";
              fullquery = "for $i in collection('"+ Config.getNomeContainerBO() +"')/BO \n";     
              fullquery += "where $i/cadastro/fim/data/date >= '2006-00-00' \n";
              fullquery += "return $i";
    ArrayList docs = new ArrayList();
    XmlResults results = null;
         XmlValue value = null;
         XmlDocument document = null;
    try {
         XmlQueryContext context = bdbxmlAmbiente.getEnvironmentInit().getManager().createQueryContext();
         context.setEvaluationType(XmlQueryContext.Eager);
         XmlQueryExpression xqe = bdbxmlAmbiente.getEnvironmentInit().getManager().prepare(fullquery, context);
         results = xqe.execute(context);
                   out.println("<p>fez busca, deletando...</p>");
    while (results.hasNext()) {
         value = results.next();
    document = value.asDocument();
         document.fetchAllData();
         out.println(document.getName() + "<br>");
    //out.println("<p>total: " + results.size() + "</p>");
    } catch (Throwable e) {
         out.println(e);
    e.printStackTrace();
    } finally {
                   results.delete();
    %>
    This basically loads about 1600 small documents (~5KB) from the container, and guess how memory is now:
    delegaciainterativa:~# free -m
    total used free shared buffers cached
    Mem: 440 429 11 0 14 282
    -/+ buffers/cache: 132 308
    Swap: 909 4 905
    That's about 83Mbs consumed!! And if I perform other searches like this, this keeps eating up more and more memory, then swapping and getting slow... and sometimes crashing Tomcat.
    Here's the big mistery: the memory NEVER GETS RELEASED. Even calling delete(), as I did explicitily, it doesnt release the memory. It keeps increasing as searches are performed.
    Now, let's go to the profiler. I've installed JProfiler and run it on this server, and here're the results: http://freeunix.com.br/All_Objects.html
    Even more puzzling, I havent got any impressive amount of memory consumption.
    So, what can I do to figure this out? The only way to release memory is to restart the server once and a while, which far from ideal.
    I'd really would appreciate any help about this, since I'm on production with this server.
    cheers,
    -- Breno Jacinto

    Hello George,
        I tried this:
    <%
              HttpSession sessao = request.getSession(true);
              BdbXmlAmbiente bdbxmlAmbiente = new BdbXmlAmbiente();
              XmlContainer container = bdbxmlAmbiente.abrirContainer(Config.getNomeContainerBO());
              String fullquery = "";
              fullquery = "for $i in collection('"+ Config.getNomeContainerBO() +"')/BO \n";     
              fullquery += "where $i/cadastro/fim/data/date >= '2006-00-00' \n";
              fullquery += "return $i";
            ArrayList docs = new ArrayList();
            XmlResults results = null;
             XmlValue value = null;
             XmlDocument document = null;
            try {
                 XmlQueryContext context = bdbxmlAmbiente.getEnvironmentInit().getManager().createQueryContext();
                 context.setEvaluationType(XmlQueryContext.Eager);
                 XmlQueryExpression xqe = bdbxmlAmbiente.getEnvironmentInit().getManager().prepare(fullquery, context);
                 results = xqe.execute(context);
                   out.println("<p>fez busca, deletando...</p>");
                while (results.hasNext()) {
                     value = results.next();
                    document = value.asDocument();
                        document.fetchAllData();
                        out.println(document.getName() + "<br>");
                        value.delete();
                        document.delete();
                //out.println("<p>total: " + results.size() + "</p>");
                   context.delete();
                   xqe.delete();
                   results.delete();
            } catch (Throwable e) {
                 out.println(e);
                e.printStackTrace();
    %>
         Don't you think that it's too much to consume ~80 MBs of RAM, in a search that returns ~1600 5 KB  documents? And worse, this amount is never released.
         I'm wondering if there's any configuration issue here? Such as JVM's Heap size, or BDBXML Environment Initialization?
    thanks,
    -- Breno

  • Memory leak in weblogic 6.0 sp2 oracle 8.1.7 thin driver

    Hi,
         I have a simple client that opens a database connection, selects from
    a table containing five rows of data (with four columns in each row)
    and then closes all connections. On running this in a loop, I get the
    following error after some time:
    <Nov 28, 2001 5:57:40 PM GMT+06:00> <Error> <Adapter>
    <OutOfMemoryError in
    Adapter
    java.lang.OutOfMemoryError
    <<no stack trace available>>
    >
    <Nov 28, 2001 5:57:40 PM GMT+06:00> <Error> <Kernel> <ExecuteRequest
    failed
    java.lang.OutOfMemoryError
    I am running with a heap size of 64 Mb. The java command that runs
    the client is:
    java -ms64m -mx64m -cp .:/opt/bea/wlserver6.0/lib/weblogic.jar
    -Djava.naming.f
    actory.initial=weblogic.jndi.WLInitialContextFactory
    -Djava.naming.provider.url=
    t3://garlic:7001 -verbose:gc Test
    The following is the client code that opens the db connection and does
    the select:
    import java.util.*;
    import java.sql.*;
    import javax.naming.*;
    import javax.sql.*;
    public class Test {
    private static final String strQuery = "SELECT * from tblPromotion";
    public static void main(String argv[])
    throws Exception
    String ctxFactory     = System.getProperty
    ("java.naming.factory.initial");
    String providerUrl     = System.getProperty
    ("java.naming.provider.url");
    Properties jndiEnv          = System.getProperties ();
    System.out.println ("ctxFactory : " + ctxFactory);
    System.out.println ("ProviderURL : " + providerUrl);
    Context ctx     = new InitialContext (jndiEnv);
    for (int i=0; i <1000000; i++)
    System.out.println("Running query for the "+i+" time");
    Connection con = null;
    Statement stmnt = null;
    ResultSet rs     = null;
    try
    DataSource ds     = (DataSource) ctx.lookup
    (System.getProperty("eaMDataStore", "jdbc/eaMarket"));
    con = ds.getConnection ();
    stmnt = con.createStatement();
    rs = stmnt.executeQuery(strQuery);
    while (rs.next ())
    //System.out.print(".");
    //System.out.println(".");
    ds = null;
    catch (java.sql.SQLException sqle)
    System.out.println("SQL Exception : "+sqle.getMessage());
    finally
    try {
    rs.close ();
    rs = null;
    //System.out.println("closed result set");
    } catch (Exception e) {
    System.out.println("Exception closing result set");
    try {
    stmnt.close ();
    stmnt = null;
    //System.out.println("closed statement");
    } catch (Exception e) {
    System.out.println("Exception closing result set");
    try {
    con.close();
    con = null;
    //System.out.println("closed connection");
    } catch (Exception e) {
    System.out.println("Exception closing connection");
    I am using the Oracle 8.1.7 thin driver. Please let me know if this
    memory leak is a known issue or if its something I am doing.
    thanks,
    rudy

    Repost in JDBC section ... very serious issue but it may be due to Oracle or
    to WL ... does it happen if you test inside WL itself?
    How many iterations does it take to blow? How long? Does changing to a
    different driver (maybe Cloudscape) have the same result?
    Peace,
    Cameron Purdy
    Tangosol Inc.
    << Tangosol Server: How Weblogic applications are customized >>
    << Download now from http://www.tangosol.com/download.jsp >>
    "R.C." <[email protected]> wrote in message
    news:[email protected]...
    Hi,
    I have a simple client that opens a database connection, selects from
    a table containing five rows of data (with four columns in each row)
    and then closes all connections. On running this in a loop, I get the
    following error after some time:
    <Nov 28, 2001 5:57:40 PM GMT+06:00> <Error> <Adapter>
    <OutOfMemoryError in
    Adapter
    java.lang.OutOfMemoryError
    <<no stack trace available>>
    >
    <Nov 28, 2001 5:57:40 PM GMT+06:00> <Error> <Kernel> <ExecuteRequest
    failed
    java.lang.OutOfMemoryError
    I am running with a heap size of 64 Mb. The java command that runs
    the client is:
    java -ms64m -mx64m -cp .:/opt/bea/wlserver6.0/lib/weblogic.jar
    -Djava.naming.f
    actory.initial=weblogic.jndi.WLInitialContextFactory
    -Djava.naming.provider.url=
    t3://garlic:7001 -verbose:gc Test
    The following is the client code that opens the db connection and does
    the select:
    import java.util.*;
    import java.sql.*;
    import javax.naming.*;
    import javax.sql.*;
    public class Test {
    private static final String strQuery = "SELECT * from tblPromotion";
    public static void main(String argv[])
    throws Exception
    String ctxFactory = System.getProperty
    ("java.naming.factory.initial");
    String providerUrl = System.getProperty
    ("java.naming.provider.url");
    Properties jndiEnv = System.getProperties ();
    System.out.println ("ctxFactory : " + ctxFactory);
    System.out.println ("ProviderURL : " + providerUrl);
    Context ctx = new InitialContext (jndiEnv);
    for (int i=0; i <1000000; i++)
    System.out.println("Running query for the "+i+" time");
    Connection con = null;
    Statement stmnt = null;
    ResultSet rs = null;
    try
    DataSource ds = (DataSource) ctx.lookup
    (System.getProperty("eaMDataStore", "jdbc/eaMarket"));
    con = ds.getConnection ();
    stmnt = con.createStatement();
    rs = stmnt.executeQuery(strQuery);
    while (rs.next ())
    //System.out.print(".");
    //System.out.println(".");
    ds = null;
    catch (java.sql.SQLException sqle)
    System.out.println("SQL Exception : "+sqle.getMessage());
    finally
    try {
    rs.close ();
    rs = null;
    //System.out.println("closed result set");
    } catch (Exception e) {
    System.out.println("Exception closing result set");
    try {
    stmnt.close ();
    stmnt = null;
    //System.out.println("closed statement");
    } catch (Exception e) {
    System.out.println("Exception closing result set");
    try {
    con.close();
    con = null;
    //System.out.println("closed connection");
    } catch (Exception e) {
    System.out.println("Exception closing connection");
    I am using the Oracle 8.1.7 thin driver. Please let me know if this
    memory leak is a known issue or if its something I am doing.
    thanks,
    rudy

  • Memory Leak In DataService

    Hi All,
          I had posted this query to couple of other groups ..I am still struglling with this issue..Hope someone  will  help me out here
          I have  very basic application which uses  DataSerives over RTMP channel  to populate dataGrid , I have not used any  user defined component.
    This application has got LOAD data and Remove data  Button just to simulate the actual application
    What happens , when I click on LOAD data , It  loads the data from server(JBOSS) then I Remove all the data and force the GC to run
    If I continuously keep loading and removing the  data ,  memory goes up every time and after some times It reaches to threshold and  finally crashes the Browser.
    In actual application as soon as user logs in a dedicated DS destination is created..
        private function createDestination(destName:String):void{
                 var remoteService:RemoteObject = new RemoteObject("DestinationManager");
                 remoteService.addEventListener(ResultEvent.RESULT, resultHandler,false,0,true);
                 var operation:AbstractOperation = remoteService.getOperation("createDestination");
                 operation.send(destName);
                 var cs:ChannelSet = new ChannelSet();
                 var rtmpChannel:RTMPChannel = ServerConfig.getChannel("my-rtmp") as  RTMPChannel;
                 cs.addChannel(rtmpChannel);
                 tradeService = new DataService() ;
                 tradeService.destination=destName;
                 tradeService.channelSet = cs;  
    Now when user hits on Load data button to load the trade data ...
       public function loadData():void
             var remoteService:RemoteObject  = new RemoteObject("filterRemoteVO");
             var operation:AbstractOperation = remoteService.getOperation("loadData");
             tradeService.fill(tradeCollection);
             operation.send(rowData.text ,GUIID);
             tradeList.dataProvider = tradeCollection;
    Remove Data  hit I clean all the resource and released collection :-
          public  function  removeAll():void{
             if(tradeList.dataProvider){
                  tradeCollection.source = new Array();
                  tradeList.dataProvider.source = new Array();
                  tradeList.dataProvider = null;
                tradeService.release();
               tradeService.releaseCollection(tradeCollection);
              tradeService.channelSet.disconnectAll();
              tradeService.disconnect();
               tradeService.logout();
               System.gc();
    Except these 3 function I don't have any code which could cause memory leak.
    I m using
    LCDS 2.5
    Flex 3.0
    JBoss4.2
    Please see the mxml file below   , If  possible please have a look at it , I might  not be using dataSerice API correctly.
    I have been trying to solve this leak for last two week , I really need help from you guys.
    My client has already evaluating other contemporary technology because of this memory issue.
    I have also created scalled down war file which can be deployed on any  java application server.
    Any help will greatly be appreciated
    Regards,
    Dam
    ######################## MXML##########################
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
          creationComplete="init();" height="100%" width="100%"
         >
         <mx:Script >
         <![CDATA[
             import mx.containers.GridRow;
               import mx.utils.Base64Decoder;
             import mx.utils.StringUtil;
                import mx.events.CollectionEvent;
             import mx.formatters.Formatter;
             import mx.events.ResizeEvent;
             import mx.controls.DataGrid;
             import mx.effects.Fade;
             import mx.events.DataGridEvent;
             import mx.utils.ObjectUtil;
             import mx.events.ScrollEvent;
           import mx.formatters.DateFormatter;
           import mx.events.ListEvent;
           import mx.data.mxml.DataService;
           import mx.messaging.config.ServerConfig;
           import mx.messaging.channels.RTMPChannel;
           import mx.messaging.ChannelSet;
           import mx.rpc.AbstractOperation;
           import mx.rpc.remoting.RemoteObject;
           import mx.collections.ArrayCollection;
           import mx.controls.Alert;
           import mx.rpc.events.ResultEvent;
           import mx.messaging.messages.*;
           import mx.messaging.events.*;
           import mx.controls.Alert;
            private var GUIID:String;
            private var lastRollOverIndex:Number;
            public var tradeService:DataService=null;
            public var tradeCollection:ArrayCollection = new ArrayCollection();
           public var flag:Boolean = false;
            private function init():void {
               var guiId:String ="TEST";
                createDestination(GUIID);
            public function getData():void{
                 // memory.text =""+ ((System.totalMemory / 1024)/1024);
            public function releaseDataServices():void {
               //  tradeService.fill(null);
                    tradeService.release();
                   // tradeService.releaseCollection(tradeCollection);
                   tradeService.channelSet.disconnectAll();
                    tradeService.disconnect();
                    tradeService.logout();
                    //tradeService.dataStore = null;
                    /*Function for creating destination*/
              private function createDestination(destName:String):void{
                 var remoteService:RemoteObject = new RemoteObject("DestinationManager");
                 remoteService.addEventListener(ResultEvent.RESULT, resultHandler,false,0,true);
                 var operation:AbstractOperation = remoteService.getOperation("createDestination");
                 operation.send(destName);
                 var cs:ChannelSet = new ChannelSet();
                 var rtmpChannel:RTMPChannel = ServerConfig.getChannel("my-rtmp") as RTMPChannel;
                 cs.addChannel(rtmpChannel);
                 tradeService = new DataService() ;
                 tradeService.destination=destName;
                 tradeService.channelSet = cs;  
             //This function calls dataservice fill method depending on wheather destination is created or not
            private function resultHandler(event:ResultEvent):void{
               //call data service as destination is created successfully
                var status:Boolean = event.result as Boolean
               // Alert.show("status="+status);
                if(status){
                 getData();
               else{
                   //TODO report error to MATS app  
          public  function  removeAll():void{
             if(tradeList.dataProvider){
                  tradeCollection.source = new Array();
                  tradeList.dataProvider.source = new Array();
                  tradeList.dataProvider = null;
                tradeService.release();
               // tradeService.releaseCollection(tradeCollection);
              tradeService.channelSet.disconnectAll();
              tradeService.disconnect();
               tradeService.logout();
               System.gc();
           public function loadData():void
             var remoteService:RemoteObject  = new RemoteObject("filterRemoteVO");
             var operation:AbstractOperation = remoteService.getOperation("loadData");
             tradeService.fill(tradeCollection);
             operation.send(rowData.text ,GUIID);
             tradeList.dataProvider = tradeCollection;
       ]]>
    </mx:Script>
          <mx:DataGrid   id="tradeList"
                 initialize="tradeList.dataProvider = tradeCollection" horizontalScrollPolicy="auto"
                   height="659" x="0" y="84">
                <mx:columns>
                     <mx:DataGridColumn  headerText="Security Description" dataField="securityDesc"
                      />
                     <mx:DataGridColumn  headerText="B/S" dataField="transactionType"
                     />
                     <mx:DataGridColumn  headerText="Amount" dataField="amount"
                     />
                     <mx:DataGridColumn  headerText="Price Text" dataField="priceText"
                     />
                     <mx:DataGridColumn  headerText="Counterparty" dataField="counterParty"
                     />
                     <mx:DataGridColumn  headerText="Trade Date" dataField="tradeDate"
                     />
                     <mx:DataGridColumn  headerText="Settle Date" dataField="settleDate"
                     />
                     <mx:DataGridColumn  headerText="Trade Status" dataField="tradeStatusId"
                     />
                     <mx:DataGridColumn  headerText="Trader" dataField="trader"
                     />
                     <mx:DataGridColumn  headerText="Salesperson" dataField="salesperson"
                     />
                     <mx:DataGridColumn  headerText="Ticket Number" dataField="tradeNumber"
                     />
                     <mx:DataGridColumn  headerText="Entry Date" dataField="tradeTime"
                     />
                     <mx:DataGridColumn  headerText="Cancel Date" dataField="cancelDate"
                     />
                     <mx:DataGridColumn  headerText="Cancel Time" dataField="cancelTime"
                     />
                 </mx:columns>
              </mx:DataGrid >
             <mx:Grid x="149" y="23" width="995">
                     <mx:GridRow width="100%" height="100%">
                                <mx:GridItem width="100%" height="100%">
                                     <mx:Label text="Enter No of obejcts"   width="111"/>
                             </mx:GridItem>
                             <mx:GridItem width="100%" height="100%">
                                     <mx:TextInput name="row" id="rowData"   width="97"/>
                             </mx:GridItem>
                             <mx:GridItem width="100%" height="100%">
                                     <mx:Button  label="Load Data" click='loadData()'/>
                             </mx:GridItem>
                             <mx:GridItem width="100%" height="100%">
                                     <mx:Button  label="removeAll" click='removeAll()'/>
                             </mx:GridItem>
                             <mx:GridItem width="100%" height="100%">
                                     <mx:Label text="Total Memory"/>
                             </mx:GridItem>
                             <mx:GridItem width="100%" height="100%">
                                     <mx:TextInput text="Total Memory" id="memory"   width="97"/>
                             </mx:GridItem>
                             <mx:GridItem width="100%" height="100%">
                                     <mx:Label text="Grid Row Count"/>
                             </mx:GridItem>
                             <mx:GridItem width="100%" height="100%">
                                     <mx:TextInput name="GridRowCountN" id="GridRowCount"   width="97"/>
                             </mx:GridItem>
                     </mx:GridRow>
             </mx:Grid>
    </mx:Application>

    Hi Natasha,
    Sorry for late reply.
          I tried your suggestion but It did not help to release memory. Actully,this app contains only one event handler which is for remote method call , I dont think this could cause any memory leak.
    Profiling session reveals that It is the issue of DataService class.I dont know How do I convince  Adobe to investigate this issue.
    Regards,
    Dharmendra

  • Memory Leak in BlazeDS

    I have used BlazeDS in an  application to push the data in realtime. However, we have been  experiencing a heavy memory leak in the application. The application has  a scheduler that pushes the data every one minute into the default  queue. Without any browsers opened, the appication remain stable. And  closing the browsers also cleans up the FlexClient object and other  associated objects for that browsers. But the leak occurs when we open  and keep browsers for a long period, say 2 to 3 days. The memory usage  of application gradually increases and throws a  "java.lang.OutOfMemoryError: Java heap space" Exception. On analyzing  the HeapDump, I found that there are thousands of AsyncMessage Objects  in the memory, not getting garbage-collected. This the channel definiton  congured in services-config.xml file
            <channel-definition id="my-polling-amf" class="mx.messaging.channels.AMFChannel">
                <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
                <properties>
                    <polling-enabled>true</polling-enabled>
                    <polling-interval-seconds>4</polling-interval-seconds>
                    <invalidate-session-on-disconnect>true</invalidate-session-on-disconn ect>
                </properties>
            </channel-definition>
    Does anyone know the cause of this issue and how it can be overcome. Please help.

    We also have the same problem. The JVM goes out of memory every 24 - 50hrs. I have documented a working fix for the problem on the JVM side.
    http://in-finite.me/fixing-blazeds-polling-amf-memory-leak/@

  • Memory leak in string class

    We have developed our application in Solaris 10 environment. While running Purify on that it shows leak in the string class. This leak is incremental and so process size keeps in increasing. If we replace string with char array, the leaks disappears and process size also becomes stable.
    Following is the snapshot of the memory leak stack reported by Purify:
    MLK: 4505 bytes leaked in 85 blocks
    * This memory was allocated from:
    malloc [rtlib.o]
    operator new(unsigned) [libCrun.so.1]
    void*operator new(unsigned) [rtlib.o]
    __rwstd::__string_ref<char,std::char_traits<char>,std::allocator<char> >*std::basic_string<char,std::char_traits<char>,std::allocator<char> >::__getRep(unsigned,unsigned) [libCstd.so.1]
    char*std::basic_string<char,std::char_traits<char>,std::allocator<char> >::replace(unsigned,unsigned,const char*,unsigned,unsigned,unsigned) [libCstd.so.1]
    std::basic_string<char,std::char_traits<char>,std::allocator<char> >&std::basic_string<char,std::char_traits<char>,std::allocator<char> >::operator=(const char*) [libCstd.so.1]
    Has anyone faced this problem earlier or is there any patch available for this?

    Over time, we have found and fixed memory leaks in the C++ runtime libraries.
    Get the latest patches for the compiler you are using. (You didn't say which one.) You can find all patches here:
    [http://developers.sun.com/sunstudio/downloads/patches/index.jsp]
    Also get the latest Solaris patch for the C++ runtime libraries, listed on the same web page.
    If that doesn't fix the problem, please file a bug report at
    [http://bugs.sun.com]
    with a test case that can be compiled and run to demonstrate the problem.

  • Memory Leak in Crystal Report XI

    We are using Crystal Reports XI Licensed Developer version for web based application. The generated reports are getting accessed by multiple users from web interface. After continuos access of reports, at some point it reaches the maximum limit of Application pool and it stops the application.
    From number of web forms, we found that crystal reports are not releasing systems memory and it keeps adding extra load on memory after a single report generation or there is memory leak. Below are the code snippets to initialize and dispose of report object.
    a. Initializing a new report obj
    protected ReportDocument _selectedRpt = new ReportDocument();
    b. Disposing obj in page_unload event
    /// <summary>
    /// Page_Unload Event handler.
    /// </summary>
    /// <param name="sender">Sending control or event.</param>
    /// <param name="e">Generic event arguments.</param>
    protected void Page_Unload(object sender, EventArgs e)
         _selectedRpt.Close();
         _selectedRpt.Dispose();
    Temporary Solution:  For its temporary resolution, we are recycling application pool twice a day for smooth processing of reports, but recycling also destroying application session.
    Please suggest a solution, which can help to run crystal reports correctly without any memory leak.

    Helena, CR XI R2 is not supported in .NET 2008. See [this|https://wiki.sdn.sap.com/wiki/display/BOBJ/WhichCrystalReportsassemblyversionsaresupportedinwhichversionsofVisualStudio+.NET] wiki for more details.
    Re. your unanswered post. Can you provide a link? I search for unanswered posts, but do not see one from you.
    Remember that this is a community forum only, not support as such. If this is an important issue and you wish to discuss it with technical support, you can create a phone case here:
    http://store.businessobjects.com/store/bobjamer/DisplayProductByTypePage&parentCategoryID=&categoryID=11522300
    Ludek

Maybe you are looking for