Memory leak in Servlet Filter handling?

In Sun Web Server 6.1, I'm finding a memory leak when using servlet filters. I've even created a "no op" servlet filter. When it's registered, every 10000 hits or so to filtered static content will eat up about 5 to 10 MB of RAM. The JVM heap size doesn't increase.
When I remove the filter, I've hit the same static page on the server 50000 times without seeing an increase in memory usage by the process.
This is on Windows 2000, and I think the Sun Web Server 6.1 is SP1. I haven't tried SP2 yet.
For reference, here's the filter I put in:
public class NoOpFilter implements Filter
public void init(FilterConfig arg0) throws ServletException {}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
chain.doFilter(request, response);
public void destroy() {}
}

I found the bug. I get the memory leak if magnus.conf has either or both of the following entries:
AdminLanguage en
DefaultLanguage en
If I delete the entries, the memory leak goes away. I suppose this should get fixed by Sun sometime. Maybe I'll figure out how to officially report the bug later.

Similar Messages

  • Memory Leak WSEndpointImpl

    Hi all,
    using R28.1.3-11-141760-1.6.0_24-20110301-1432-linux-x86_64 of jrockit we experience a memory leak in production. So far I only got to obtain an hprof dump, which I analyzed with eclipse MAT. I'm trying to obtain a flight recording as well but I'm not sure if this will shed more light on the problem. The MAT result is pretty clear but I'm not sure what the cause is. There's one object of com.sun.xml.ws.server.WSEndpointImpl with a growing retained heap, at the moment of the memory dump it was 929 MB. Here's the import part of the dominator tree:
    Class Name | Shallow Heap | Retained Heap | Percentage
    com.sun.xml.ws.server.WSEndpointImpl @ 0xafaf0f70 | 176 | 929.780.784 | 69,61%
    |- com.sun.xml.ws.binding.SOAPBindingImpl @ 0xafaf1160 | 72 | 929.046.360 | 69,56%
    | |- com.sun.xml.ws.binding.WebServiceFeatureList @ 0xafaf13e0 | 56 | 929.044.320 | 69,56%
    | | '- java.util.HashMap @ 0xafaf1e58 | 80 | 929.044.264 | 69,56%
    | | |- java.util.HashMap$Entry[16] @ 0xafaf3058 | 152 | 929.044.160 | 69,56%
    | | | |- java.util.HashMap$Entry @ 0xaf9b8f48 | 48 | 928.998.912 | 69,55%
    | | | | '- weblogic.wsee.jaxws.EndpointCreationInterceptorFeature @ 0xaf9b8f80| 32 | 928.998.864 | 69,55%
    | | | | '- java.util.HashSet @ 0xaf9b92f8 | 24 | 928.998.832 | 69,55%
    | | | | '- java.util.HashMap @ 0xaf9b9528 | 80 | 928.998.808 | 69,55%
    | | | | |- java.util.HashMap$Entry[32768] @ 0x9462cb88 | 262.168 | 928.998.704 | 69,55%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0x9b672ae8 | 40 | 152.104 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0xad2a9360 | 40 | 152.104 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0xa3949490 | 40 | 152.104 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0xa3a332c8 | 40 | 152.104 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0x954ef698 | 40 | 151.440 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0xb3acff18 | 40 | 148.256 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0xa1db8a38 | 40 | 148.000 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0xb9d18ee8 | 40 | 148.000 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0xbe6bf4d0 | 40 | 147.896 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0xa0397080 | 40 | 147.896 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0xbf6693f0 | 40 | 147.896 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0xc3c4ddb0 | 40 | 143.792 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0x82714140 | 40 | 143.792 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0xa0347178 | 40 | 143.792 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0x919c9948 | 40 | 143.688 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0xbb1f6d28 | 40 | 135.960 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0x8c3cd118 | 40 | 135.488 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0x91d6e950 | 40 | 134.936 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0x8abefe80 | 40 | 134.936 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0x89f0aaa8 | 40 | 134.736 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0xb0f116a8 | 40 | 134.600 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0x9da69938 | 40 | 134.392 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0x96cae018 | 40 | 134.392 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0x88691950 | 40 | 134.040 | 0,01%
    | | | | | |- weblogic.wsee.jaxws.ServerLateInitTube @ 0xc201f268 | 40 | 134.040 | 0,01%
    | | | | | '- Total: 25 of 36.803 entries | | |
    I would appreciate any hints on how to proceed as these are standard java / weblogic classes. If I drill down into the objects I see some ErrorHandler objects, so these objects might accumulate with erroneus requests, but I'm not positive on this since I only checked a few instances. Before I start to try to reproduce this on a test environment I would like to ask for your help.
    Kind regards,
    Thomas
    PS: Sorry, this is probably not really jrockit related, but I know here are some java experts ;)

    Hi Marcus,
    thanks. The FlightRecording did not help, the allocation pressure is not high enough. I eventually fired up memleak and found the following allocation trace, which doesn't help me a lot. I will post in WLS forums.
    Trace     Type     Type ID     Class Loader     Class Loader ID     Percent(%)     Count
    weblogic.wsee.jaxws.ServerLateInitTube.copy(TubeCloner)     weblogic.wsee.jaxws.ServerLateInitTube     98     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    weblogic.wsee.jaxws.ServerLateInitTube.copy(TubeCloner)     weblogic.wsee.jaxws.ServerLateInitTube     98     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    com.sun.xml.ws.api.pipe.PipeClonerImpl.copy(Tube)     com.sun.xml.ws.api.pipe.PipeClonerImpl     15773     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    weblogic.wsee.jaxws.ServerLateInitTube.<init>(ServerLateInitTube, TubeCloner)     weblogic.wsee.jaxws.ServerLateInitTube     98     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    weblogic.wsee.jaxws.ServerLateInitTube.copy(TubeCloner)     weblogic.wsee.jaxws.ServerLateInitTube     98     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    weblogic.wsee.jaxws.ServerLateInitTube.copy(TubeCloner)     weblogic.wsee.jaxws.ServerLateInitTube     98     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    com.sun.xml.ws.api.pipe.PipeClonerImpl.copy(Tube)     com.sun.xml.ws.api.pipe.PipeClonerImpl     15773     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    com.sun.xml.ws.api.pipe.helper.AbstractFilterTubeImpl.<init>(AbstractFilterTubeImpl, TubeCloner)     com.sun.xml.ws.api.pipe.helper.AbstractFilterTubeImpl     15774     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    weblogic.wsee.jaxws.tubeline.standard.WseeServerTube.<init>(WseeServerTube, TubeCloner)     weblogic.wsee.jaxws.tubeline.standard.WseeServerTube     2450     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    weblogic.wsee.jaxws.tubeline.standard.WseeServerTube.copy(TubeCloner)     weblogic.wsee.jaxws.tubeline.standard.WseeServerTube     2450     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    weblogic.wsee.jaxws.tubeline.standard.WseeServerTube.copy(TubeCloner)     weblogic.wsee.jaxws.tubeline.standard.WseeServerTube     2450     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    com.sun.xml.ws.api.pipe.PipeClonerImpl.copy(Tube)     com.sun.xml.ws.api.pipe.PipeClonerImpl     15773     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    com.sun.xml.ws.api.pipe.TubeCloner.clone(Tube)     com.sun.xml.ws.api.pipe.TubeCloner     15776     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    com.sun.xml.ws.server.WSEndpointImpl$2.<init>(WSEndpointImpl)     com.sun.xml.ws.server.WSEndpointImpl$2     15319     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    com.sun.xml.ws.server.WSEndpointImpl.createPipeHead()     com.sun.xml.ws.server.WSEndpointImpl     2523     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    com.sun.xml.ws.api.server.Adapter$Toolkit.<init>(Adapter)     com.sun.xml.ws.api.server.Adapter$Toolkit     15770     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.<init>(HttpAdapter)     com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit     15306     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    com.sun.xml.ws.transport.http.HttpAdapter.createToolkit()     com.sun.xml.ws.transport.http.HttpAdapter     15467     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    com.sun.xml.ws.transport.http.HttpAdapter.createToolkit()     com.sun.xml.ws.transport.http.HttpAdapter     15467     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    com.sun.xml.ws.api.server.Adapter$1.create()     com.sun.xml.ws.api.server.Adapter$1     2807     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    com.sun.xml.ws.api.server.Adapter$1.create()     com.sun.xml.ws.api.server.Adapter$1     2807     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    com.sun.xml.ws.util.Pool.take()     com.sun.xml.ws.util.Pool     15771     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    com.sun.xml.ws.transport.http.HttpAdapter.handle(WSHTTPConnection)     com.sun.xml.ws.transport.http.HttpAdapter     15467     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletContext, HttpServletRequest, HttpServletResponse)     com.sun.xml.ws.transport.http.servlet.ServletAdapter     3251     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(HttpServletRequest, HttpServletResponse, ServletContext)     com.sun.xml.ws.transport.http.servlet.WSServletDelegate     4388     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(HttpServletRequest, HttpServletResponse, ServletContext)     com.sun.xml.ws.transport.http.servlet.WSServletDelegate     4388     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(HttpServletRequest, HttpServletResponse)     com.sun.xml.ws.transport.http.servlet.WSServlet     4743     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    javax.servlet.http.HttpServlet.service(HttpServletRequest, HttpServletResponse)     javax.servlet.http.HttpServlet     15468     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    javax.servlet.http.HttpServlet.service(ServletRequest, ServletResponse)     javax.servlet.http.HttpServlet     15468     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run()     weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction     15469     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    weblogic.servlet.internal.StubSecurityHelper.invokeServlet(ServletRequest, HttpServletRequest, ServletRequestImpl, ServletResponse, HttpServletResponse, Servlet)     weblogic.servlet.internal.StubSecurityHelper     1044     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    weblogic.servlet.internal.ServletStubImpl.execute(ServletRequest, ServletResponse, FilterChainImpl)     weblogic.servlet.internal.ServletStubImpl     907     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    weblogic.servlet.internal.ServletStubImpl.execute(ServletRequest, ServletResponse)     weblogic.servlet.internal.ServletStubImpl     907     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(ServletStubImpl, HttpServletRequest, HttpServletResponse)     weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction     15310     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run()     weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction     15310     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AbstractSubject, PrivilegedAction)     weblogic.security.acl.internal.AuthenticatedSubject     2125     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    weblogic.security.service.SecurityManager.runAs(AuthenticatedSubject, AuthenticatedSubject, PrivilegedAction)     weblogic.security.service.SecurityManager     15464     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    weblogic.servlet.internal.WebAppServletContext.securedExecute(HttpServletRequest, HttpServletResponse, boolean)     weblogic.servlet.internal.WebAppServletContext     1108     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    weblogic.servlet.internal.WebAppServletContext.execute(ServletRequestImpl, ServletResponseImpl)     weblogic.servlet.internal.WebAppServletContext     1108     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    weblogic.servlet.internal.ServletRequestImpl.run()     weblogic.servlet.internal.ServletRequestImpl     67     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    weblogic.work.ExecuteThread.execute(Runnable)     weblogic.work.ExecuteThread     1085     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    weblogic.work.ExecuteThread.run()     weblogic.work.ExecuteThread     1085     sun.misc.Launcher$AppClassLoader<0>     0     100     17
    Kind regards,
    Thomas

  • Memory Leak w/ WebLogic 5.1

    I've created a simple servlet to EJB skeleton and built a stress testing
              tool to make sequential requests to the servlet which in turn creates an
              instance of a stateless session been. Both the servlet and bean do not have
              any real logic in them, just some minimal timing output.
              When run for a few million iterations, the WebLogic JVM slowly leaks memory
              that cannot be reclaimed even with force garbage collection from the
              WebLogic console. Below are 3 snippets of code showing the servlet, the EJB
              call, and the simple client test.
              If anyone else is ecperiencing similar problems or can see a flaw, I'd be
              most grateful.
              Andy
              Servlet code
              protected void doGet(HttpServletRequest req, HttpServletResponse res)
              throws ServletException, IOException
              TestBean bean;
              long requestStartTime = System.currentTimeMillis();
              res.setContentType("text/html");
              PrintWriter out = res.getWriter();
              out.println("<html><head><title>Hello World!</title></head>");
              out.println("<body><h1>Hello World!</h1></body></html>");
              try {
              bean = home.create();;
              bean.testMethod();
              catch (Exception e) {
              totalTime += (System.currentTimeMillis() - requestStartTime);
              Bean code
              public class TestBean implements SessionBean {
              private SessionContext ctx;
              public void ejbActivate() {
              public void ejbPassivate() {
              public void ejbCreate() {
              public void ejbRemove() {
              public void setSessionContext(SessionContext ctx) {
              this.ctx = ctx;
              public void testMethod() {
              Client code
              public void simulateLoad()
              throws IOException
              long totalRequestTime = 0, requestTime, requestStartTime;
              long totalResponseTime = 0, responseTime, responseStartTime;
              try {
              log("Opening connection to "+ url + (debug ? "?debug=true" : ""));
              for (int i = 1; i <= numRequests; i++) {
              HTTPConnection con = new HTTPConnection("localhost",7001);
              HTTPResponse rsp;
              byte data[];
              if ((i % 10000) == 0) {
              log("\nGET Request "+i+" to "+ url + (debug ? "?debug=true" :
              requestStartTime = System.currentTimeMillis();
              rsp = con.Get("/mcumanager" + (debug ? "?debug=true" : ""));
              requestTime = System.currentTimeMillis() - requestStartTime;
              responseStartTime = System.currentTimeMillis();
              if (rsp.getStatusCode() >= 300) {
              log("Received Error: "+rsp.getReasonLine());
              log(new String(rsp.getData()));
              else
              data = rsp.getData();
              responseTime = System.currentTimeMillis() - responseStartTime;
              totalRequestTime += requestTime;
              totalResponseTime += responseTime;
              if ((i % 10000) == 0) {
              log("GET Response "+i+": "+rsp);
              if ((i % 100) == 0) {
              log ("Avg request time :
              "+((float)totalRequestTime/(float)i)+"ms");
              log ("Avg response time :
              "+((float)totalResponseTime/(float)i)+"ms");
              catch (IOException ioe) {
              log(ioe.toString());
              ioe.printStackTrace();
              catch (ModuleException me) {
              log("Error handling request: " + me.getMessage());
              me.printStackTrace();
              

    Please read discussion "WLS dies during stress testing" & "performance
              degradation PROBLEM" in interest.performance.
              Hope it helps.
              Cheers - Wei
              Andy Riedel <[email protected]> wrote in message
              news:[email protected]...
              > I have additional information on this problem. I have replicated the exact
              > same memory leak issue using the included HelloWorldServlet. I use Jrun's
              > ServletKiller stress tool running 16 simultaneous request threads
              requesting
              > the HelloWorldServlet. This WebLogic 5.1 server will leak memory and
              > eventually run out of memory all together with an OutOfMemoryException
              after
              > about 6-8 hours. This indicates that the bug is in the base HTTP Servlet
              > engine code.
              >
              > I have tried turning off the http log (i.e. access.log) as well as
              > notification events from the servlet engine and it still leaks memory.
              >
              > Andy
              >
              >
              >
              > Andy Riedel Chief Architect HearMe Call me through VoiceCONTACTtm -- right
              > from your computer. Online Status:
              > "Andy Riedel" <[email protected]> wrote in message
              > news:[email protected]...
              > > I've created a simple servlet to EJB skeleton and built a stress testing
              > > tool to make sequential requests to the servlet which in turn creates an
              > > instance of a stateless session been. Both the servlet and bean do not
              > have
              > > any real logic in them, just some minimal timing output.
              > >
              > > When run for a few million iterations, the WebLogic JVM slowly leaks
              > memory
              > > that cannot be reclaimed even with force garbage collection from the
              > > WebLogic console. Below are 3 snippets of code showing the servlet, the
              > EJB
              > > call, and the simple client test.
              > >
              > > If anyone else is ecperiencing similar problems or can see a flaw, I'd
              be
              > > most grateful.
              > >
              > > Andy
              > >
              > >
              > > Servlet code
              > > -------------
              > >
              > > protected void doGet(HttpServletRequest req, HttpServletResponse res)
              > > throws ServletException, IOException
              > > {
              > > TestBean bean;
              > >
              > > long requestStartTime = System.currentTimeMillis();
              > >
              > > res.setContentType("text/html");
              > > PrintWriter out = res.getWriter();
              > > out.println("<html><head><title>Hello World!</title></head>");
              > > out.println("<body><h1>Hello World!</h1></body></html>");
              > >
              > > try {
              > > bean = home.create();;
              > > bean.testMethod();
              > > }
              > > catch (Exception e) {
              > > }
              > >
              > > totalTime += (System.currentTimeMillis() - requestStartTime);
              > > }
              > >
              > > Bean code
              > > -----------
              > > public class TestBean implements SessionBean {
              > >
              > > private SessionContext ctx;
              > >
              > > public void ejbActivate() {
              > > }
              > >
              > > public void ejbPassivate() {
              > > }
              > >
              > > public void ejbCreate() {
              > > }
              > >
              > > public void ejbRemove() {
              > > }
              > >
              > > public void setSessionContext(SessionContext ctx) {
              > > this.ctx = ctx;
              > > }
              > >
              > > public void testMethod() {
              > > }
              > > }
              > >
              > > Client code
              > > ------------
              > > public void simulateLoad()
              > > throws IOException
              > > {
              > > long totalRequestTime = 0, requestTime, requestStartTime;
              > > long totalResponseTime = 0, responseTime, responseStartTime;
              > >
              > > try {
              > > log("Opening connection to "+ url + (debug ? "?debug=true" : ""));
              > >
              > > for (int i = 1; i <= numRequests; i++) {
              > >
              > > HTTPConnection con = new HTTPConnection("localhost",7001);
              > > HTTPResponse rsp;
              > > byte data[];
              > >
              > > if ((i % 10000) == 0) {
              > > log("\nGET Request "+i+" to "+ url + (debug ? "?debug=true" :
              > > ""));
              > > }
              > >
              > > requestStartTime = System.currentTimeMillis();
              > >
              > > rsp = con.Get("/mcumanager" + (debug ? "?debug=true" : ""));
              > >
              > > requestTime = System.currentTimeMillis() - requestStartTime;
              > >
              > > responseStartTime = System.currentTimeMillis();
              > >
              > > if (rsp.getStatusCode() >= 300) {
              > > log("Received Error: "+rsp.getReasonLine());
              > > log(new String(rsp.getData()));
              > > }
              > > else
              > > data = rsp.getData();
              > >
              > > responseTime = System.currentTimeMillis() - responseStartTime;
              > >
              > > totalRequestTime += requestTime;
              > > totalResponseTime += responseTime;
              > >
              > > if ((i % 10000) == 0) {
              > > log("GET Response "+i+": "+rsp);
              > > }
              > >
              > > if ((i % 100) == 0) {
              > > log ("Avg request time :
              > > "+((float)totalRequestTime/(float)i)+"ms");
              > > log ("Avg response time :
              > > "+((float)totalResponseTime/(float)i)+"ms");
              > > }
              > > }
              > > }
              > > catch (IOException ioe) {
              > > log(ioe.toString());
              > > ioe.printStackTrace();
              > > }
              > > catch (ModuleException me) {
              > > log("Error handling request: " + me.getMessage());
              > > me.printStackTrace();
              > > }
              > > }
              > >
              > >
              > >
              > >
              > >
              >
              >
              

  • Pro*c multithreaded application has memory leak

    Hi there,
    I posted this message a week ago in OCI section, nobody answer me.
    I am really curious if my application has a bug or the pro*c has a bug.
    Anyone can compile the sample code and test it easily.
    I made multithreaded application which queries dynamic SQL, it works.
    But the memory leaks when i query the SQL statement.
    The more memory leaks, the more i query the SQL statement, even same SQL
    statement.
    I check it with top, shell command.
    My machine is SUN E450, Solaris 8. Oracle 9.2.0.1
    Compiler : gcc (GCC) 3.2.2
    I changed source code which is from
    $(ORACLE_HOME)/precomp/demo/proc/sample10.pc
    the sample10 doesn't need to be multithreaded. But i think it has to work
    correctly if i changed it to multithreaded application.
    the make file and source code will be placed below.
    I have to figure out the problem.
    Please help
    Thanks in advance,
    the make file is below
    HOME = /user/jkku
    ORA = $(ORACLE_HOME)
    CC = gcc
    PROC = proc
    LC_INCL = -I$(HOME)/work/dbmss/libs/include
    lc_incl = include=$(HOME)/work/dbmss/libs/include
    SYS_INCL =
    sys_incl =
    ORA_INCL = -I. \
    -I$(ORA)/precomp/public \
    -I$(ORA)/rdbms/public \
    -I$(ORA)/rdbms/demo \
    -I$(ORA)/rdbms/pbsql/public \
    -I$(ORA)/network/public \
    -DSLMXMX_ENABLE -DSLTS_ENABLE -D_SVID_GETTOD
    INCLUDES = $(LC_INCL) $(SYS_INCL) $(ORA_INCL)
    includes = $(lc_incl) $(sys_incl)
    LC_LIBS =
    SYS_LIBS = -lpthread -lsocket -lnsl -lrt
    ORA_LIBS = -L$(ORA)/lib/ -lclntsh
    LIBS = $(LC_LIBS) $(SYS_LIBS) $(ORA_LIBS)
    # Define C Compiler flags
    CFLAGS += -D_Solaris64_ -m64
    CFLAGS += -g -D_REENTRANT
    # Define pro*c Compiler flags
    PROCFLAGS += THREADS=YES
    PROCFLAGS += CPOOL=YES
    # Our object files
    PRECOMPS = sample10.c
    OBJS = sample10.o
    .SUFFIXES: .o .c .pc
    .c.o:
    $(CC) -c $(CFLAGS) $(INCLUDES) $*.c
    .pc.c:
    $(PROC) $(PROCFLAGS) $(includes) $*.pc $*.c
    all: sample10
    sample10: $(PRECOMPS) $(OBJS)
    $(CC) $(CFLAGS) -o sample10 $(OBJS) $(LIBS)
    clean:
    rm -rf *.o sample10 sample10.c
    the source code is below which i changed the oracle sample10.pc to
    multithreaded application.
    Sample Program 10: Dynamic SQL Method 4
    This program connects you to ORACLE using your username and
    password, then prompts you for a SQL statement. You can enter
    any legal SQL statement. Use regular SQL syntax, not embedded SQL.
    Your statement will be processed. If it is a query, the rows
    fetched are displayed.
    You can enter multi-line statements. The limit is 1023 characters.
    This sample program only processes up to MAX_ITEMS bind variables and
    MAX_ITEMS select-list items. MAX_ITEMS is #defined to be 40.
    #include <stdio.h>
    #include <string.h>
    #include <setjmp.h>
    #include <sqlda.h>
    #include <stdlib.h>
    #include <sqlcpr.h>
    /* Maximum number of select-list items or bind variables. */
    #define MAX_ITEMS 40
    /* Maximum lengths of the names of the
    select-list items or indicator variables. */
    #define MAX_VNAME_LEN 30
    #define MAX_INAME_LEN 30
    #ifndef NULL
    #define NULL 0
    #endif
    /* Prototypes */
    #if defined(__STDC__)
    void sql_error(void);
    int oracle_connect(void);
    int alloc_descriptors(int, int, int);
    int get_dyn_statement(void);
    void set_bind_variables(void);
    void process_select_list(void);
    void help(void);
    #else
    void sql_error(/*_ void _*/);
    int oracle_connect(/*_ void _*/);
    int alloc_descriptors(/*_ int, int, int _*/);
    int get_dyn_statement(/* void _*/);
    void set_bind_variables(/*_ void -*/);
    void process_select_list(/*_ void _*/);
    void help(/*_ void _*/);
    #endif
    char *dml_commands[] = {"SELECT", "select", "INSERT", "insert",
    "UPDATE", "update", "DELETE", "delete"};
    EXEC SQL INCLUDE sqlda;
    EXEC SQL INCLUDE sqlca;
    EXEC SQL BEGIN DECLARE SECTION;
    char dyn_statement[1024];
    EXEC SQL VAR dyn_statement IS STRING(1024);
    EXEC SQL END DECLARE SECTION;
    EXEC ORACLE OPTION (ORACA=YES);
    EXEC ORACLE OPTION (RELEASE_CURSOR=YES);
    SQLDA *bind_dp;
    SQLDA *select_dp;
    /* Define a buffer to hold longjmp state info. */
    jmp_buf jmp_continue;
    char *db_uid="dbmuser/dbmuser@dbmdb";
    sql_context ctx;
    int err_sql;
    enum{
    SQL_SUCC=0,
    SQL_ERR,
    SQL_NOTFOUND,
    SQL_UNIQUE,
    SQL_DISCONNECT,
    SQL_NOTNULL
    int main()
    int i;
    EXEC SQL ENABLE THREADS;
    EXEC SQL WHENEVER SQLERROR DO sql_error();
    EXEC SQL WHENEVER NOT FOUND DO sql_not_found();
    /* Connect to the database. */
    if (connect_database() < 0)
    exit(1);
    EXEC SQL CONTEXT USE :ctx;
    /* Process SQL statements. */
    for (;;)
    /* Allocate memory for the select and bind descriptors. */
    if (alloc_descriptors(MAX_ITEMS, MAX_VNAME_LEN, NAME_LEN) != 0)
    exit(1);
    (void) setjmp(jmp_continue);
    /* Get the statement. Break on "exit". */
    if (get_dyn_statement() != 0)
    break;
    EXEC SQL PREPARE S FROM :dyn_statement;
    EXEC SQL DECLARE C CURSOR FOR S;
    /* Set the bind variables for any placeholders in the
    SQL statement. */
    set_bind_variables();
    /* Open the cursor and execute the statement.
    * If the statement is not a query (SELECT), the
    * statement processing is completed after the
    * OPEN.
    EXEC SQL OPEN C USING DESCRIPTOR bind_dp;
    /* Call the function that processes the select-list.
    * If the statement is not a query, this function
    * just returns, doing nothing.
    process_select_list();
    /* Tell user how many rows processed. */
    for (i = 0; i < 8; i++)
    if (strncmp(dyn_statement, dml_commands, 6) == 0)
    printf("\n\n%d row%c processed.\n", sqlca.sqlerrd[2], sqlca.sqlerrd[2] == 1 ? '\0' : 's');
    break;
    /* Close the cursor. */
    EXEC SQL CLOSE C;
    /* When done, free the memory allocated for pointers in the bind and
    select descriptors. */
    for (i = 0; i < MAX_ITEMS; i++)
    if (bind_dp->V != (char *) 0)
    free(bind_dp->V);
    free(bind_dp->I); /* MAX_ITEMS were allocated. */
    if (select_dp->V != (char *) 0)
    free(select_dp->V);
    free(select_dp->I); /* MAX_ITEMS were allocated. */
    /* Free space used by the descriptors themselves. */
    SQLSQLDAFree(ctx, bind_dp);
    SQLSQLDAFree(ctx, select_dp);
    } /* end of for(;;) statement-processing loop */
    disconnect_database();
    EXEC SQL WHENEVER SQLERROR CONTINUE;
    EXEC SQL COMMIT WORK RELEASE;
    puts("\nHave a good day!\n");
    return;
    * Allocate the BIND and SELECT descriptors using sqlald().
    * Also allocate the pointers to indicator variables
    * in each descriptor. The pointers to the actual bind
    * variables and the select-list items are realloc'ed in
    * the set_bind_variables() or process_select_list()
    * routines. This routine allocates 1 byte for select_dp->V
    * and bind_dp->V, so the realloc will work correctly.
    alloc_descriptors(size, max_vname_len, max_iname_len)
    int size;
    int max_vname_len;
    int max_iname_len;
    int i;
    * The first sqlald parameter determines the maximum number of
    * array elements in each variable in the descriptor. In
    * other words, it determines the maximum number of bind
    * variables or select-list items in the SQL statement.
    * The second parameter determines the maximum length of
    * strings used to hold the names of select-list items
    * or placeholders. The maximum length of column
    * names in ORACLE is 30, but you can allocate more or less
    * as needed.
    * The third parameter determines the maximum length of
    * strings used to hold the names of any indicator
    * variables. To follow ORACLE standards, the maximum
    * length of these should be 30. But, you can allocate
    * more or less as needed.
    if ((bind_dp =
    SQLSQLDAAlloc(ctx, size, max_vname_len, max_iname_len)) ==
    (SQLDA *) 0)
    fprintf(stderr,
    "Cannot allocate memory for bind descriptor.");
    return -1; /* Have to exit in this case. */
    if ((select_dp =
    SQLSQLDAAlloc(ctx, size, max_vname_len, max_iname_len)) == (SQLDA *)
    0)
    fprintf(stderr,
    "Cannot allocate memory for select descriptor.");
    return -1;
    select_dp->N = MAX_ITEMS;
    /* Allocate the pointers to the indicator variables, and the
    actual data. */
    for (i = 0; i < MAX_ITEMS; i++) {
    bind_dp->I = (short *) malloc(sizeof (short));
    select_dp->I = (short *) malloc(sizeof(short));
    bind_dp->V = (char *) malloc(1);
    select_dp->V = (char *) malloc(1);
    return 0;
    int get_dyn_statement()
    char *cp, linebuf[256];
    int iter, plsql;
    for (plsql = 0, iter = 1; ;)
    if (iter == 1)
    printf("\nSQL> ");
    dyn_statement[0] = '\0';
    fgets(linebuf, sizeof linebuf, stdin);
    cp = strrchr(linebuf, '\n');
    if (cp && cp != linebuf)
    *cp = ' ';
    else if (cp == linebuf)
    continue;
    if ((strncmp(linebuf, "EXIT", 4) == 0) ||
    (strncmp(linebuf, "exit", 4) == 0))
    return -1;
    else if (linebuf[0] == '?' ||
    (strncmp(linebuf, "HELP", 4) == 0) ||
    (strncmp(linebuf, "help", 4) == 0))
    help();
    iter = 1;
    continue;
    if (strstr(linebuf, "BEGIN") ||
    (strstr(linebuf, "begin")))
    plsql = 1;
    strcat(dyn_statement, linebuf);
    if ((plsql && (cp = strrchr(dyn_statement, '/'))) ||
    (!plsql && (cp = strrchr(dyn_statement, ';'))))
    *cp = '\0';
    break;
    else
    iter++;
    printf("%3d ", iter);
    return 0;
    void set_bind_variables()
    int i, n;
    char bind_var[64];
    /* Describe any bind variables (input host variables) */
    EXEC SQL WHENEVER SQLERROR DO sql_error();
    bind_dp->N = MAX_ITEMS; /* Initialize count of array elements. */
    EXEC SQL DESCRIBE BIND VARIABLES FOR S INTO bind_dp;
    /* If F is negative, there were more bind variables
    than originally allocated by sqlald(). */
    if (bind_dp->F < 0)
    printf ("\nToo many bind variables (%d), maximum is %d\n.",
    -bind_dp->F, MAX_ITEMS);
    return;
    /* Set the maximum number of array elements in the
    descriptor to the number found. */
    bind_dp->N = bind_dp->F;
    /* Get the value of each bind variable as a
    * character string.
    * C contains the length of the bind variable
    * name used in the SQL statement.
    * S contains the actual name of the bind variable
    * used in the SQL statement.
    * L will contain the length of the data value
    * entered.
    * V will contain the address of the data value
    * entered.
    * T is always set to 1 because in this sample program
    * data values for all bind variables are entered
    * as character strings.
    * ORACLE converts to the table value from CHAR.
    * I will point to the indicator value, which is
    * set to -1 when the bind variable value is "null".
    for (i = 0; i < bind_dp->F; i++)
    printf ("\nEnter value for bind variable %.*s: ",
    (int)bind_dp->C, bind_dp->S);
    fgets(bind_var, sizeof bind_var, stdin);
    /* Get length and remove the new line character. */
    n = strlen(bind_var) - 1;
    /* Set it in the descriptor. */
    bind_dp->L = n;
    /* (re-)allocate the buffer for the value.
    sqlald() reserves a pointer location for
    V but does not allocate the full space for
    the pointer. */
    bind_dp->V = (char *) realloc(bind_dp->V, (bind_dp->L + 1));
    /* And copy it in. */
    strncpy(bind_dp->V, bind_var, n);
    /* Set the indicator variable's value. */
    if ((strncmp(bind_dp->V, "NULL", 4) == 0) ||
    (strncmp(bind_dp->V, "null", 4) == 0))
    *bind_dp->I = -1;
    else
    *bind_dp->I = 0;
    /* Set the bind datatype to 1 for CHAR. */
    bind_dp->T = 1;
    return;
    void process_select_list()
    int i, null_ok, precision, scale;
    if ((strncmp(dyn_statement, "SELECT", 6) != 0) &&
    (strncmp(dyn_statement, "select", 6) != 0))
    select_dp->F = 0;
    return;
    /* If the SQL statement is a SELECT, describe the
    select-list items. The DESCRIBE function returns
    their names, datatypes, lengths (including precision
    and scale), and NULL/NOT NULL statuses. */
    select_dp->N = MAX_ITEMS;
    EXEC SQL DESCRIBE SELECT LIST FOR S INTO select_dp;
    /* If F is negative, there were more select-list
    items than originally allocated by sqlald(). */
    if (select_dp->F < 0)
    printf ("\nToo many select-list items (%d), maximum is %d\n",
    -(select_dp->F), MAX_ITEMS);
    return;
    /* Set the maximum number of array elements in the
    descriptor to the number found. */
    select_dp->N = select_dp->F;
    /* Allocate storage for each select-list item.
    sqlprc() is used to extract precision and scale
    from the length (select_dp->L).
    sqlnul() is used to reset the high-order bit of
    the datatype and to check whether the column
    is NOT NULL.
    CHAR datatypes have length, but zero precision and
    scale. The length is defined at CREATE time.
    NUMBER datatypes have precision and scale only if
    defined at CREATE time. If the column
    definition was just NUMBER, the precision
    and scale are zero, and you must allocate
    the required maximum length.
    DATE datatypes return a length of 7 if the default
    format is used. This should be increased to
    9 to store the actual date character string.
    If you use the TO_CHAR function, the maximum
    length could be 75, but will probably be less
    (you can see the effects of this in SQL*Plus).
    ROWID datatype always returns a fixed length of 18 if
    coerced to CHAR.
    LONG and
    LONG RAW datatypes return a length of 0 (zero),
    so you need to set a maximum. In this example,
    it is 240 characters.
    printf ("\n");
    for (i = 0; i < select_dp->F; i++)
    char title[MAX_VNAME_LEN];
    /* Turn off high-order bit of datatype (in this example,
    it does not matter if the column is NOT NULL). */
    sqlnul ((unsigned short *)&(select_dp->T), (unsigned short
    *)&(select_dp->T), &null_ok);
    switch (select_dp->T)
    case 1 : /* CHAR datatype: no change in length
    needed, except possibly for TO_CHAR
    conversions (not handled here). */
    break;
    case 2 : /* NUMBER datatype: use sqlprc() to
    extract precision and scale. */
    sqlprc ((unsigned int *)&(select_dp->L), &precision,
    &scale);
    /* Allow for maximum size of NUMBER. */
    if (precision == 0) precision = 40;
    /* Also allow for decimal point and
    possible sign. */
    /* convert NUMBER datatype to FLOAT if scale > 0,
    INT otherwise. */
    if (scale > 0)
    select_dp->L = sizeof(float);
    else
    select_dp->L = sizeof(int);
    break;
    case 8 : /* LONG datatype */
    select_dp->L = 240;
    break;
    case 11 : /* ROWID datatype */
    case 104 : /* Universal ROWID datatype */
    select_dp->L = 18;
    break;
    case 12 : /* DATE datatype */
    select_dp->L = 9;
    break;
    case 23 : /* RAW datatype */
    break;
    case 24 : /* LONG RAW datatype */
    select_dp->L = 240;
    break;
    /* Allocate space for the select-list data values.
    sqlald() reserves a pointer location for
    V but does not allocate the full space for
    the pointer. */
    if (select_dp->T != 2)
    select_dp->V = (char *) realloc(select_dp->V,
    select_dp->L + 1);
    else
    select_dp->V = (char *) realloc(select_dp->V,
    select_dp->L);
    /* Print column headings, right-justifying number
    column headings. */
    /* Copy to temporary buffer in case name is null-terminated */
    memset(title, ' ', MAX_VNAME_LEN);
    strncpy(title, select_dp->S, select_dp->C);
    if (select_dp->T == 2)
    if (scale > 0)
    printf ("%.*s ", select_dp->L+3, title);
    else
    printf ("%.*s ", select_dp->L, title);
    else
    printf("%-.*s ", select_dp->L, title);
    /* Coerce ALL datatypes except for LONG RAW and NUMBER to
    character. */
    if (select_dp->T != 24 && select_dp->T != 2)
    select_dp->T = 1;
    /* Coerce the datatypes of NUMBERs to float or int depending on
    the scale. */
    if (select_dp->T == 2)
    if (scale > 0)
    select_dp->T = 4; /* float */
    else
    select_dp->T = 3; /* int */
    printf ("\n\n");
    /* FETCH each row selected and print the column values. */
    EXEC SQL WHENEVER NOT FOUND GOTO end_select_loop;
    for (;;)
    EXEC SQL FETCH C USING DESCRIPTOR select_dp;
    /* Since each variable returned has been coerced to a
    character string, int, or float very little processing
    is required here. This routine just prints out the
    values on the terminal. */
    for (i = 0; i < select_dp->F; i++)
    if (*select_dp->I < 0)
    if (select_dp->T == 4)
    printf ("%-*c ",(int)select_dp->L+3, ' ');
    else
    printf ("%-*c ",(int)select_dp->L, ' ');
    else
    if (select_dp->T == 3) /* int datatype */
    printf ("%*d ", (int)select_dp->L,
    *(int *)select_dp->V);
    else if (select_dp->T == 4) /* float datatype */
    printf ("%*.2f ", (int)select_dp->L,
    *(float *)select_dp->V);
    else /* character string */
    printf ("%-*.*s ", (int)select_dp->L,
    (int)select_dp->L, select_dp->V);
    printf ("\n");
    end_select_loop:
    return;
    void help()
    puts("\n\nEnter a SQL statement or a PL/SQL block at the SQL> prompt.");
    puts("Statements can be continued over several lines, except");
    puts("within string literals.");
    puts("Terminate a SQL statement with a semicolon.");
    puts("Terminate a PL/SQL block (which can contain embedded
    semicolons)");
    puts("with a slash (/).");
    puts("Typing \"exit\" (no semicolon needed) exits the program.");
    puts("You typed \"?\" or \"help\" to get this message.\n\n");
    int connect_database()
    err_sql = SQL_SUCC;
    EXEC SQL WHENEVER SQLERROR DO sql_error();
    EXEC SQL WHENEVER NOT FOUND DO sql_not_found();
    EXEC SQL CONTEXT ALLOCATE :ctx;
    EXEC SQL CONTEXT USE :ctx;
    EXEC SQL CONNECT :db_uid;
    if(err_sql != SQL_SUCC){
    printf("err => connect database(ctx:%ld, uid:%s) failed!\n", ctx, db_uid);
    return -1;
    return 1;
    int disconnect_database()
    err_sql = SQL_SUCC;
    EXEC SQL WHENEVER SQLERROR DO sql_error();
    EXEC SQL WHENEVER NOT FOUND DO sql_not_found();
    EXEC SQL CONTEXT USE :ctx;
    EXEC SQL COMMIT WORK RELEASE;
    EXEC SQL CONTEXT FREE:ctx;
    return 1;
    void sql_error()
    printf("err => %.*s", sqlca.sqlerrm.sqlerrml, sqlca.sqlerrm.sqlerrmc);
    printf("in \"%.*s...\'\n", oraca.orastxt.orastxtl, oraca.orastxt.orastxtc);
    printf("on line %d of %.*s.\n\n", oraca.oraslnr, oraca.orasfnm.orasfnml,
    oraca.orasfnm.orasfnmc);
    switch(sqlca.sqlcode) {
    case -1: /* unique constraint violated */
    err_sql = SQL_UNIQUE;
    break;
    case -1012: /* not logged on */
    case -1089:
    case -3133:
    case -1041:
    case -3114:
    case -3113:
    /* �6�Ŭ�� shutdown�ǰų� �α��� ���°� �ƴҶ� ��b�� �õ� */
    /* immediate shutdown in progress - no operations are permitted */
    /* end-of-file on communication channel */
    /* internal error. hostdef extension doesn't exist */
    err_sql = SQL_DISCONNECT;
    break;
    case -1400:
    err_sql = SQL_NOTNULL;
    break;
    default:
    err_sql = SQL_ERR;
    break;
    EXEC SQL CONTEXT USE :ctx;
    EXEC SQL WHENEVER SQLERROR CONTINUE;
    EXEC SQL ROLLBACK WORK;
    void sql_not_found()
    err_sql = SQL_NOTFOUND;

    Hi Jane,
    What version of Berkeley DB XML are you using?
    What is your operating system and your hardware platform?
    For how long have been the application running?
    What is your current container size?
    What's set for EnvironmentConfig.setThreaded?
    Do you know if containers have previously not been closed correctly?
    Can you please post the entire error output?
    What's the JDK version, 1.4 or 1.5?
    Thanks,
    Bogdan

  • Bug:4705928 PLSQL: Memory leak using small varrays

    We have Oracle version 10.2.0.1.0
    We have a problem with a procedure.
    In our scenario we make use of VARRAY in the procedure to pass some filter parameters to a select distinct querying a view made on three tables.
    Unfotunately not always execution it is successful.
    Sometimes it returns wrong value (0 for the count parameter), sometimes (rarely) the server stops working.
    We suspect that this is caused by a bug fixed in versione 10.2.0.3.0
    Bug:4705928 PLSQL: Memory leak using small varrays when trimming the whole collection and inserting into it in a loop
    We suspect this becasue we made two procedure the first (spProductCount) uses a function (fnProductFilter) to calculate the values of a varray and passes them into the select,
    while in the second procedure (spProductCount2) parameters are passed directly into the statement without varray
    and there are failures only in the first procedure.
    On the other hand on another server 10.2.0.1.0 we never have this problem.
    The instance manifesting the bug runs under shared mode, while the other is under dedicated mode.
    Turning the first one to dedicated mode makes the bugs disapear.
    Unfortunately this is not a solution.
    In the sample there are the three table with all constraints, the view, tha varray custom type, the function and the two procedures.
    Is there someone that may examine our sample and tell us if the pl/sql code corresponds to the bug desciption.
    We also want to know if it's possibile that the same server running under different mode (SHARED/DEDICATED) doesn't behave the same way.
    The tables:
    --Products
    CREATE TABLE "Products" (
         "Image" BLOB
         , "CatalogId" RAW(16)
         , "ProductId" RAW(16)
         , "MnemonicId" NVARCHAR2(50) DEFAULT ''
         , "ProductParentId" RAW(16)
    ALTER TABLE "Products"
         ADD CONSTRAINT "NN_Products_M04" CHECK ("CatalogId" IS NOT NULL)
    ALTER TABLE "Products"
         ADD CONSTRAINT "NN_Products_M05" CHECK ("ProductId" IS NOT NULL)
    ALTER TABLE "Products"
    ADD CONSTRAINT "PK_Products"
    PRIMARY KEY ("ProductId")
    CREATE INDEX "IX_Products"
    ON "Products" ("CatalogId", "MnemonicId")
    CREATE UNIQUE INDEX "UK_Products"
    ON "Products" (DECODE("MnemonicId", NULL, NULL, RAWTOHEX("CatalogId") || "MnemonicId"))
    --Languages
    CREATE TABLE "Languages" (
         "Description" NVARCHAR2(250)
         , "IsStandard" NUMBER(1)
         , "LanguageId" RAW(16)
         , "MnemonicId" NVARCHAR2(12)
    ALTER TABLE "Languages"
         ADD CONSTRAINT "NN_Languages_M01" CHECK ("LanguageId" IS NOT NULL)
    ALTER TABLE "Languages"
         ADD CONSTRAINT "NN_Languages_M05" CHECK ("MnemonicId" IS NOT NULL)
    ALTER TABLE "Languages"
    ADD CONSTRAINT "PK_Languages"
    PRIMARY KEY ("LanguageId")
    ALTER TABLE "Languages"
    ADD CONSTRAINT "UK_Languages"
    UNIQUE ("MnemonicId")
    --ProductDesc
    CREATE TABLE "ProductDesc" (
         "Comment" NCLOB
         , "PlainComment" NCLOB
         , "Description" NVARCHAR2(250)
         , "DescriptionText" NCLOB
         , "PlainDescriptionText" NCLOB
         , "LanguageId" NVARCHAR2(12)
         , "ProductId" RAW(16)
    ALTER TABLE "ProductDesc"
         ADD CONSTRAINT "NN_ProductDescM01" CHECK ("LanguageId" IS NOT NULL)
    ALTER TABLE "ProductDesc"
         ADD CONSTRAINT "NN_ProductDescM02" CHECK ("ProductId" IS NOT NULL)
    ALTER TABLE "ProductDesc"
    ADD CONSTRAINT "PK_ProductDesc"
    PRIMARY KEY ("ProductId", "LanguageId")
    ALTER TABLE "ProductDesc"
    ADD CONSTRAINT "FK_ProductDesc1"
    FOREIGN KEY("ProductId") REFERENCES "Products" ("ProductId")
    ALTER TABLE "ProductDesc"
    ADD CONSTRAINT "FK_ProductDesc2"
    FOREIGN KEY("LanguageId") REFERENCES "Languages" ("MnemonicId")
    /The view:
    --ProductView
    CREATE OR REPLACE VIEW "vwProducts"
    AS
         SELECT
               "Products"."CatalogId"
              , "ProductDesc"."Comment"
              , "ProductDesc"."PlainComment"
              , "ProductDesc"."Description"
              , "ProductDesc"."DescriptionText"
              , "ProductDesc"."PlainDescriptionText"
              , "Products"."Image"
              , "Languages"."MnemonicId" "LanguageId"
              , "Products"."MnemonicId"
              , "Products"."ProductId"
              , "Products"."ProductParentId"
              , TRIM(NVL("ProductDesc"."Description" || ' ', '') || NVL("ParentDescriptions"."Description", '')) "FullDescription"
         FROM "Products"
         CROSS JOIN "Languages"
         LEFT OUTER JOIN "ProductDesc"
         ON "Products"."ProductId" = "ProductDesc"."ProductId"
         AND "ProductDesc"."LanguageId" = "Languages"."MnemonicId"
         LEFT OUTER JOIN "ProductDesc" "ParentDescriptions"
         ON "Products"."ProductParentId" = "ParentDescriptions"."ProductId"
         AND ("ParentDescriptions"."LanguageId" = "Languages"."MnemonicId")
    /The varray:
    --CustomType VARRAY
    CREATE OR REPLACE TYPE Varray_Params IS VARRAY(100) OF NVARCHAR2(1000);
    /The function:
    --FilterFunction
    CREATE OR REPLACE FUNCTION "fnProductFilter" (
         parCatalogId "Products"."CatalogId"%TYPE,
         parLanguageId                    NVARCHAR2 := N'it-IT',
         parFilterValues                    OUT Varray_Params
    RETURN INTEGER
    AS
         varSqlCondition                    VARCHAR2(32000);
         varSqlConditionValues          NVARCHAR2(32000);
         varSql                              NVARCHAR2(32000);
         varDbmsCursor                    INTEGER;
         varDbmsResult                    INTEGER;
         varSeparator                    VARCHAR2(2);
         varFilterValue                    NVARCHAR2(1000);
         varCount                         INTEGER;
    BEGIN
         varSqlCondition := '(T_Product."CatalogId" = HEXTORAW(:parentId)) AND (T_Product."LanguageId" = :languageId )';
         varSqlConditionValues := CHR(39) || TO_CHAR(parCatalogId) || CHR(39) || N', ' || CHR(39 USING NCHAR_CS) || parLanguageId || CHR(39 USING NCHAR_CS);
         parFilterValues := Varray_Params();
         varSql := N'SELECT FilterValues.column_value FilterValue FROM TABLE(Varray_Params(' || varSqlConditionValues || N')) FilterValues';
         BEGIN
              varDbmsCursor := dbms_sql.open_cursor;
              dbms_sql.parse(varDbmsCursor, varSql, dbms_sql.native);
              dbms_sql.define_column(varDbmsCursor, 1, varFilterValue, 1000);
              varDbmsResult := dbms_sql.execute(varDbmsCursor);
              varCount := 0;
              LOOP
                   IF (dbms_sql.fetch_rows(varDbmsCursor) > 0) THEN
                        varCount := varCount + 1;
                        dbms_sql.column_value(varDbmsCursor, 1, varFilterValue);
                        parFilterValues.extend(1);
                        parFilterValues(varCount) := varFilterValue;
                   ELSE
                        -- No more rows to copy
                        EXIT;
                   END IF;
              END LOOP;
              dbms_sql.close_cursor(varDbmsCursor);
         EXCEPTION WHEN OTHERS THEN
              dbms_sql.close_cursor(varDbmsCursor);
              RETURN 0;
         END;
         FOR i in parFilterValues.first .. parFilterValues.last LOOP
              varSeparator := ', ';
         END LOOP;
         RETURN 1;
    END;
    /The procedures:
    --Procedure presenting anomaly\bug
    CREATE OR REPLACE PROCEDURE "spProductCount" (
         parCatalogId "Products"."CatalogId"%TYPE,
         parLanguageId NVARCHAR2 := N'it-IT',
         parRecords OUT NUMBER
    AS
         varFilterValues Varray_Params;
         varResult INTEGER;
         varSqlTotal VARCHAR2(32000);
    BEGIN
         parRecords := 0;
         varResult := "fnProductFilter"(parCatalogId, parLanguageId, varFilterValues);
         varSqlTotal := 'BEGIN
         SELECT count(DISTINCT T_Product."ProductId") INTO :parCount FROM "vwProducts" T_Product
              WHERE ((T_Product."CatalogId" = HEXTORAW(:parentId)) AND (T_Product."LanguageId" = :languageId ));
    END;';
         EXECUTE IMMEDIATE varSqlTotal USING OUT parRecords, varFilterValues(1), varFilterValues(2);
    END;
    --Procedure NOT presenting anomaly\bug
    CREATE OR REPLACE PROCEDURE "spProductCount2" (
         parCatalogId "Products"."CatalogId"%TYPE,
         parLanguageId NVARCHAR2 := N'it-IT',
         parRecords OUT NUMBER
    AS
         varFilterValues Varray_Params;
         varResult INTEGER;
         varSqlTotal VARCHAR2(32000);
    BEGIN
         parRecords := 0;
         varSqlTotal := 'BEGIN
         SELECT count(DISTINCT T_Product."ProductId") INTO :parCount FROM "vwProducts" T_Product
              WHERE ((T_Product."CatalogId" = HEXTORAW(:parentId)) AND (T_Product."LanguageId" = :languageId ));
    END;';
         EXECUTE IMMEDIATE varSqlTotal USING OUT parRecords, parCatalogId, parLanguageId;
    END;Edited by: 835125 on 2011-2-9 1:31

    835125 wrote:
    Using VARRAY was the only way I found to transform comma seprated text values (e.g. "'abc', 'def', '123'") in a collection of strings.A varray is just a functionally crippled version of a nested table collection type, with a defined limit you probably don't need. (Why 100 specifically?) Instead of
    CREATE OR REPLACE TYPE varray_params AS VARRAY(100) OF NVARCHAR2(1000);try
    CREATE OR REPLACE TYPE array_params AS TABLE OF NVARCHAR2(1000);I don't know whether that will solve the problem but at least it'll be a slightly more useful type.
    What makes you think it's a memory leak specifically? Do you observe session PGA memory use going up more than it should?
    btw good luck with all those quoted column names. I wouldn't like to have to work with those, although they do make the forum more colourful.
    Edited by: William Robertson on Feb 11, 2011 7:54 AM

  • Memory leak in Tomcat 5.5

    Hi all, i am experiencing memory leaks while using tomcat 5.5 and mysql connector 3.1.7.. While running the attached code tomcat swallows up to 20 mb and doesnt return it. I close down everything but the app still leaks mem. For now it's not an issue (Tomcat stays below 60mb mem of 1gb), however running this app on serveral clients will dramatically increase the memory allocation.
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.awt.Image;
    import java.awt.Graphics2D;
    import java.awt.geom.AffineTransform;
    import java.awt.image.BufferedImage;
    import javax.swing.ImageIcon;
    import com.sun.image.codec.jpeg.JPEGCodec;
    import com.sun.image.codec.jpeg.JPEGImageEncoder;
    public class Thumbs extends HttpServlet {
      private String dbDriver = "com.mysql.jdbc.Driver";
      private String dbURL = "jdbc:mysql://localhost/webapp?";
      private String userID = "javauser";
      private String passwd = "javadude";
      private Connection dbConnection;
      //Initialize global variables
      public void init() throws ServletException {
      //Process the HTTP Get request
      public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        try{
           String maxDim = "";
           String siteString = request.getParameterValues("s")[0];
           if (request.getParameterValues("d") != null){
               maxDim = request.getParameterValues("d")[0];
           if (maxDim == ""){
               response.setContentType("image/jpeg");
               OutputStream out = response.getOutputStream();
               writePicture(out,siteString);
           else{
               if (siteString != null) {
                   int maxDimension = Integer.parseInt(maxDim);
                   response.setContentType("image/jpeg");
                   OutputStream out = response.getOutputStream();
                   writeThumbnailPicture(out, siteString, maxDimension);
        } catch (Exception ex){
            ex.printStackTrace();
            log(ex.getMessage());
      public void writePicture(OutputStream out, String siteID){
          try{
              Class.forName(dbDriver);
              dbConnection = DriverManager.getConnection(dbURL, userID, passwd);
              PreparedStatement stmt = dbConnection.prepareStatement("select * from webcatalog where ID = ?");
              stmt.setString(1,siteID);
              stmt.executeQuery();
              ResultSet rs = stmt.getResultSet();
              if (rs.next()) {
                  byte[] data = rs.getBytes("Picture");
                  if (data != null) {
                      Image inImage = new ImageIcon(data).getImage();
                      BufferedImage outImage = new BufferedImage(inImage.getWidth(null),
                                                                 inImage.getHeight(null),
                                                                 BufferedImage.TYPE_INT_RGB);
                      // Paint image.
                      Graphics2D g2d = outImage.createGraphics();
                      g2d.drawImage(inImage,null,null);
                      // JPEG-encode the image
                      JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
                      encoder.encode(outImage);
                      out.close();
              rs.close();
              stmt.close();
              dbConnection.close();
          }catch(Exception ex){
              ex.printStackTrace();
      public void writeThumbnailPicture(OutputStream out,String siteID,int maxDimension){
        try{
          Class.forName(dbDriver);
          dbConnection = DriverManager.getConnection(dbURL, userID, passwd);
          PreparedStatement stmt = dbConnection.prepareStatement("select * from webcatalog where ID = ?");
          stmt.setString(1,siteID);
          stmt.executeQuery();
          ResultSet rs = stmt.getResultSet();
          if (rs.next()) {
            byte[] data = rs.getBytes("Picture");
            if (data != null) {
              Image inImage = new ImageIcon(data).getImage();
              // Determine the scale.
               double scale = (double)maxDimension / (double)inImage.getHeight(null);
               if (inImage.getWidth(null) > inImage.getHeight(null)) {
                   scale = (double)maxDimension /(double)inImage.getWidth(null);
               // Determine size of new image.
               // One of them should equal maxDim.
               int scaledW = (int)(scale*inImage.getWidth(null));
               int scaledH = (int)(scale*inImage.getHeight(null));
               // Create an image buffer in
               //which to paint on.
               BufferedImage outImage = new BufferedImage(scaledW, scaledH,
                   BufferedImage.TYPE_INT_RGB);
               // Set the scale.
               AffineTransform tx = new AffineTransform();
               // If the image is smaller than
               // the desired image size,
               // don't bother scaling.
               if (scale < 1.0d) {
                   tx.scale(scale, scale);
               // Paint image.
               Graphics2D g2d = outImage.createGraphics();
               g2d.drawImage(inImage, tx, null);
               g2d.dispose();
               // JPEG-encode the image
               JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
               encoder.encode(outImage);
               out.close();
          rs.close();
          stmt.close();
          dbConnection.close();
        catch(Exception ex){
          ex.printStackTrace();
      //Clean up resources
      public void destroy() {
      private void jbInit() throws Exception {
    }

    you can try this:
    open your connection outside the function, and then pass it like as a parameter...
    writePicture(OutputStream out, String siteID, Connection conn)
    this can solve the problem because opening the connection inside the function spends a lot of memory...
    Hope this can help you
    Regards
    Fernando

  • Memory leak in redeploy

    I am doing some memory profiling for an application running inside OC4J standalone. When the application is redeployed to OC4J, OC4J does not release memory for servlets and all the instances that's defined as class variables, e.g. private static Object s_instace. So if the application is redeployed 5 times, I saw 5 instances in the memory while gabarge collection can not collect them, and eventually the application runs out of memory if redeployed multiple times without restarting OC4J. I am wondering if anyone has encountered this issue before?

    Hello cguo:
    Thanks for reporting the problem.
    This is a recognized minor problem in oc4j standalone (and hence also in application server.) It is believed that the memory leak is not big enough to be a serious concern, unless an application is redeployed many times in a production environment, which is an unlikely. In any case, this bug should be fixed in the next oc4j production. Please try the next oc4j production release when it comes (when? I am not sure) and tell me if the problem still persists.

  • Memory Leak issue with TreeView

    Hi,
    I get Memory Leaks in the TreeView, if I open the stage which contains the TreeView several times.
    Everytime I open the stage, I clear the TreeView and populate it with new items.
    However there are leaks.
    I think this is a bug. But maybe my code is wrong and someone could comment on this issue.
    See this test case:
    i < 10: 5854 KB
    i < 100: 35944 KB
    i < 200: 64515 KB
    import javafx.application.Application;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.TreeItem;
    import javafx.scene.control.TreeView;
    import javafx.scene.layout.VBox;
    import javafx.stage.Stage;
    import javafx.stage.WindowEvent;
    public class TestApp3 extends Application {
        public static void main(String[] args) throws Exception {
            launch(args);
        public void start(final Stage stage) throws Exception {
            VBox root = new VBox();
            SubStage subStage = new SubStage();
            for (int i = 0; i < 10; i++) {
                subStage.show();
                subStage.hide();
            System.gc();
            System.out.println((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 + " KB");
            Scene scene = new Scene(root);
            stage.setScene(scene);
            stage.show();
        private class SubStage extends Stage {
            public SubStage() {
                TreeView<String> treeView = new TreeView<String>();
                final TreeItem<String> rootNode = new TreeItem<String>("Root");
                treeView.setRoot(rootNode);
                setOnShowing(new EventHandler<WindowEvent>() {
                    @Override
                    public void handle(WindowEvent windowEvent) {
                        rootNode.getChildren().clear();
                        rootNode.getChildren().add(new TreeItem<String>("Item"));
                Scene scene = new Scene(treeView);
                setScene(scene);
    }Edited by: csh on 07.09.2012 06:14
    Edited by: csh on 07.09.2012 06:14

    Hi. If You replace
        rootNode.getChildren().clear();
        rootNode.getChildren().add(new TreeItem<String>("Item"));
      with:
         rootNode.getChildren().setAll( new TreeItem<String>("Item"));
    You will get the following:
    i < 10: 2881 KB
    i < 100: 3341 KB
    I <200: 3478 KB

  • 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 TCL UDP socket

    Hi all,
    I am currently looking at a memory leak issue in the TCL UDP socket configuration when the fconfigure command is issued under a procedure.
    Under a normal scenario where the socket is configured globally, the system handles the memory well and we do not see an increase.
    The folowing examples are not the actual code implemented but provide an example of the condition under which the leak is seen.
    set msg [udp_open]
    fconfigure $msg -blocking false -buffering none -translation binary -remote [list 10.70.0.112 1234]
    proc send {} {
        global msg
        puts -nonewline $msg "HELLOHELLOHELLOHELLOHELLOHELLOHELLOHELLOHELLO"
        return
    set done 0
    while {($done <= 1000)} {
        set done [expr {$done + 1}]
        after 250
        send
    If we wish do dynamically modify the parameters of the socket, we get an ever increasing consumption of memory (show memory dead - decrease in processor free). for example:
    set clients [list]
    lappend clients "10.70.0.111 1234"
    lappend clients "10.70.0.112 1234"
    set msg [udp_open]
    fconfigure $msg -blocking false -buffering none -translation binary
    proc send {} {
        global clients
        global msg
        foreach peer $clients {
            fconfigure $msg -remote $peer
            puts -nonewline $msg "HELLOHELLOHELLOHELLOHELLOHELLOHELLOHELLOHELLO"
        return
    set done 0
    while {($done <= 1000)} {
        set done [expr {$done + 1}]
        after 250
        send
    I have tested multiple scenatios using flush, return, closing and opening the socket within the procedure, all to the same result - fconfigure in a procedure creates a memory leak in line with the data rate passing through the socket.
    I am seeing this across multiple device types and IOS (819,5915,5940,2901,2921,3945) 15 series M/T/GC IOS. I guess the question is, is there a problem with the construct of the procedure in which I am missing something on the channel side to release the memory or does this appear to be a bug?
    any help would be appreciated.
    Regards,
    Robert.

    Hi,
    could you please tell me the package version number you are using?
    You can obtain it by calling "package re udp".
    thx

  • Memory leak in OCI while using AQ

    There seems to be a serious memory leak in the OCI driver (9.2.0.1) when using a JAVA client to dequeue a database queue (Advanced Queuing).
    Continuous dequeuing causes the heap memory to increase, and this memory never gets freed which leads me to suspect a memory leak in the OCI components (as the memory allocated for the JVM is constant). The heap memory increases by 3-4 MB after a dequeue of 1000 RAW messages,
    Has anyone come across this problem before and if so are there any solutions? Changing to a thin driver is not a solution for me due to other requirements.
    I'm using using Oracle client v9.2.0.1 libraries running on Solaris 8.
    The source code for my JAVA test client is as below:
    /* JAVA dequeue */
    package com.ubsw.risk.pce.eventqueues.test;
    import oracle.AQ.*;
    import java.sql.*;
    import oracle.jdbc.*;
    public class testRawDequeue {
    public testRawDequeue() {
    public static void main(String[] args) {
    Connection conn = null;
    AQSession aq_sess = null;
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    //Use OCI connection
    conn = DriverManager.getConnection("jdbc:oracle:oci:@DB_NAME.world","user","password");
    conn.setAutoCommit(false);
    Class.forName("oracle.AQ.AQOracleDriver");
    while(true) {
    aq_sess = AQDriverManager.createAQSession(conn);
    runTest(aq_sess);
    aq_sess.close();
    aq_sess = null;
    System.gc();
    } catch (Exception e) {
    e.printStackTrace();
    System.out.println(e.toString());
    try {
    if (aq_sess != null) {
    aq_sess.close();
    if (conn != null) {
    conn.close();
    } catch (SQLException sqle) {
    public static void runTest(AQSession aq_sess) throws AQException, SQLException
    AQQueueTable q_table;
    AQQueue queue;
    AQMessage message;
    AQRawPayload raw_payload;
    AQEnqueueOption enq_option;
    String test_data = "new message";
    AQDequeueOption deq_option;
    byte[] b_array;
    /* Get a handle to a queue - in aquser schema: */
    queue = aq_sess.getQueue ("user", "raw_msg_queue");
    System.out.println("Successful getQueue");
    /* Creating a AQDequeueOption object with default options: */
    deq_option = new AQDequeueOption();
    /* Dequeue a message: */
    message = queue.dequeue(deq_option);
    System.out.println("Successful dequeue");
    /* Retrieve raw data from the message: */
    raw_payload = message.getRawPayload();
    b_array = raw_payload.getBytes();
    System.out.println("bytes:" + b_array.toString());
    queue.close();
    ((AQOracleSession)aq_sess).getDBConnection().commit();

    This sounds very similar to the memory leak I have in Oracle 9i using Pro*C++. Everytime a connect is made memory appears to leak and it only happens in multithreaded mode not default mode. There is a thread about this under the Oracle C++ call interface. Under 9i it appears to leak about 60K per connect rather than 60 bytes.
    Paul

  • Memory leak in Waveform Graph?

    Either thier is a huge memory leak in the waveform graph or I am really doing something wrong.
    I created an example app with a waveform graph and a button the contructor looks as follows:
    Form1(void)
    InitializeComponent();
    vals = gcnew array<double>(60000) ;
    for (int i=0; i<60000; i++)
    vals[i]=Math:in(Math:: PI*2*60/6000.0*i) ;
    and the click event looks like this:
    System::Void button1_Click(System:: Object^ sender, System::EventArgs^ e)
    this->waveformGraph1->Plots->Clear() ;
    NationalInstruments::UI::WaveformPlot^ plot = gcnew NationalInstruments::UI::WaveformPlot(xAxis1, yAxis1) ;
    plot->PlotY(vals) ;
    plot->LineColor = Color::Red ;
    this->waveformGraph1->Plots->Add(plot) ;
    every time I click the button the memory used on my system goes up by about 10 MB.  I tried this also with using this->waveformGraph1->PlotY(vals) and the memory usage stays solid as a rock.
    Am I doing something wrong or what is causing the leak so I can work around it, my program plots 4 arrays of this size on one graph per test result.

    The plot uses some unmanaged resources (gdi objects and other handles), which is why it implements IDisposible. Because of the GC, resource cleanup is not deterministic, clean up occurs when the GC deems it necessary. Calling delete (which based on C++/CLI syntax) ultimately ends up calling Dispose and this forces the object to release any handles it might have immedietly. See the documentation for the .NET Dispose pattern for more information.
    If you don't call delete, what would end up happening is that eventually at some point in the application, the GC would fire and cleanup all the objects and handles and you would see a drop in the applications memory footprint, but you would need to run the application for a while before that might happen. In a long application run, things would end up stabilizing.
    Bilal Durrani
    NI

  • Memory leak in oracle.exe and mds.exe

    We are facing Memory leak in oue MDM server. Our environment details
    are as follows;
    MDM 5.5 SP5 ( Build 5.5.41.70)
    Oracle 10.2 patch 2
    windows server 2003 SP1
    XI 7.0 SP 9
    If server is running continuously 3-4 days then Nonpaged memory is
    getting exausted and server does not respond. Now we have to retart the
    windows server manually.
    If we see the task manager it is shows more than 200,000 handles for
    oracle.exe and more than 100,000 handles for mds.exe.
    1: Oracle.exe -- more than 200000 handles ( Approx >5000 is problem)
    2: Mds.exe -- more than 100000 handles ( Approx >5000 is problem)
    Since these applications are not releasing the handles properly so all
    nonpaged memory gets exausted and server stops responding.
    If we restart the mdm server, database and OracleserviceMDMD, then
    nonpaged memory is released. But some times even if we restart these
    services, we do not get nonpaged memory released. So we have to restart
    the windows server.
    please help me if anyone else have faced the same problem.
    regards
    Saurabh

    Closing as question is answered in MDM forum.

  • Memory Leak in 8.1.6.0.1 JDBC/OCI for Solaris

    Hello,
    there is a memory leak in the 8.1.6.0.1 JDBC-OCI driver for solaris.
    The leak causes your jvm to eat up all memory
    if you reuse callable statements
    (calling one statement multiple times with
    different values).
    The thin driver has no such problem. Is
    there any fix available ?

    Ok. The code spans multiple classes and
    most of it comes from a customized version
    of the Enhydra Java Application server.
    I have a class called "StandardDBConnection"
    which caches CallableStatements and is a
    wrapperclass for java.sql.DBConnection. The
    interesting method here is "prepareCall":
    * Get a callable statement given an SQL string. If the statement is
    * cached, return that statement, otherwise prepare and save in the
    * cache.
    * @param sql The SQL statement to be called.
    * @return a new CallableStatement object containing the
    * pre-compiled SQL statement.
    * @exception java.sql.SQLException If a database access error occurs
    * statement.
    public synchronized CallableStatement prepareCall(String sql)
    throws SQLException {
    PreparedStatement preparedStmt;
    logDebug ("Prepare call: " + sql);
    validate();
    preparedStmt = (PreparedStatement)preparedStmtCache.get(sql);
    // Check if the object returned by the cache really is a
    // callable statement. if it is not, someone did call first
    // prepareStatement() and now prepareCall() with the same
    // sql. Silently replace the existing cache entry by a
    // callable statement in this case.
    if (preparedStmt instanceof CallableStatement) {
    preparedStmt.clearParameters();
    else {
    // Need to close the old PreparedStatement in case we have to
    // replace it with a CallableStatement
    if (preparedStmt != null) {
    preparedStmt.close();
    else if (preparedStmtCache.size() >= maxPreparedStmts) {
    String key = (String)preparedStmtCache.keys().nextElement();
    ((PreparedStatement) preparedStmtCache.remove(key)).close();
    preparedStmt = connection.prepareCall(sql);
    preparedStmtCache.put(sql, preparedStmt);
    return (CallableStatement)preparedStmt;
    The statements get closed when I close the
    connection:
    boolean closeStmts = true;
    // Close the prepared statements.
    Enumeration e = preparedStmtCache.keys();
    while (e.hasMoreElements() && closeStmts) {
    String key = (String)e.nextElement();
    try {
    ((PreparedStatement)
    preparedStmtCache.remove(key)).close();
    } catch (SQLException except) {
    // Ignore errors, we maybe handling one.
    closeStmts = false;
    log.write(Logger.NOTICE,
    "DBConnection[" + id + "]: " + url +
    "\nUnable to close statements. Continuing....\n");
    In my classes using database queries I just
    use the prepareCall method of DBConnection
    and do not have to care about anything.
    Works perfectly with the thin driver, but
    as soon as I switch to oci... :-|
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by JDBC Dev Team:
    Soda, Rupper,
    Do you mind posting some code that shows us what your code was doing when you notice this leak?
    Thanks.<HR></BLOCKQUOTE>
    null

  • Help with Java Memory Leak in URLConnection

    Hi everyone,
    I can't seem to find the memory leak in the below code, if anyone could help, i would greatly appreciate it. The jist of the code is: I open up a URLConnection to update a ColdFusion page that takes in URL parameters passed in my URL. Then, I get the response. I also check for proxy usage and take that into consideration when making the connection.
    I have one class to handle the Connections, Connect.java:
         * Connection using Username and Password, as well as boolean option to use Basic Proxy Authentication
         public Connect(String pHost, String pPort, String urlString,
                             String pUsername, String pPassword, boolean useProxy) {
              this.pHost = pHost;
              this.pPort = pPort;
              this.urlString = urlString;
              this.pUsername = pUsername;
              this.pPassword = pPassword;
              this.useProxy = useProxy;
         * Get the Input Stream from the Connection given a specific URL
         public java.io.InputStream getInputStream(String urlString) {
              if (urlString == null) urlString = this.urlString;
                 exDialog = new ExceptionDialog(new javax.swing.JFrame());
              try {
                   String auth = "";
                   if (useProxy) {
                        System.getProperties().put("proxySet", "true");
                        System.getProperties().put("proxyHost", pHost);
                        System.getProperties().put("proxyPort", pPort);
                        String authString = "";
                        if (pUsername != null && pUsername != "") authString = pUsername + ":";
                        else authString = "username:";
                        if (pPassword != null && pPassword != "") authString = authString + pPassword;
                        else authString = authString + "password";
                        auth = "Basic " + new sun.misc.BASE64Encoder().encode(authString.getBytes());
                   java.net.URL url = new java.net.URL(urlString);
                   java.net.HttpURLConnection conn = (java.net.HttpURLConnection)url.openConnection();
                   if (useProxy) conn.setRequestProperty("Proxy-Authorization", auth);
                   conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)");
                   conn.setDoInput( true );
                   conn.setDoOutput( true );
                   conn.connect();
                   return conn.getInputStream();
              } catch (java.io.IOException ioe) {
                   exDialog.showForThrowable(ioe.toString(),ioe);
                   return null;
         }I call the code in Download.java:
    Connect conn = new Connect(sm.pHost, sm.pPort, null, sm.pUser, sm.pPass, sm.useProxy);
    new BufferedReader(new InputStreamReader(conn.getInputStream(sUpdateURL)));
    in.close();For some reason, as I loop through this call, the memory footprint of my program grows through every iteration, eventually resulting in a Java Out of Memory error. I can't track the leak down and it's fairly frustrating. If anyone can help, that would be greatly appreciated. Thanks!

    One place there might be a memory leak is in the line
    exDialog = new ExceptionDialog(new javax.swing.JFrame());Even though the JFrame object goes out of scope when the ExceptionDialog method returns, JFrames stay around until they are closed, even though in this case it isn't even shown on the screen.

Maybe you are looking for

  • Using the 'route print' Command in Windows 7 - Detailed Screen Captures

    The 'route print' Command from an Administrative Command Prompt in Windows 7 provides a variety of useful information.  Let's take a look at the output of a 'route print' Command to examine how the output data is grouped and to understand its logic.

  • PDF Tags and Accessibility

    Hi,     According to my knowledge whenever i open any pdf file which is not tagged, Reader itself adds tags for easy navigation i guess and when i close it those tags are not preserved(saved basically). Is it possible that using some API, i can extra

  • ITunes store not working and unable to upgrade

    I can not access my iTunes store I have a blank white screen and when I try to upgrade to 10.5 I get an error message about not being connected to the internet is anyone else having a problem similar to this?

  • Solar_project_admin additional tab need

    hi, in Solution manager 4.0 goto t-code SOLAR_PROJECT_ADMIN , select and change any  one implementation project , double click that it will take you to the change project screen , in below tab you can find one tab named Project Standards,select that

  • DPM 2012 Failed to update permissions used in end-user recovery

    Hello everyone, I'm going to try the clearest way possible to describe the problem. Our test server is Windows Server 2012 with DPM 2012 SP1 CU2 (BKP-SRV01) with a Remote SQL server 2012 (PBASC) I protected a share folder on a DC on Windows Server 20