-2

I am getting the following error and the JVM stops functioning

    ERROR [ContainerBase] Servlet.service() for servlet jsp threw exception
java.lang.OutOfMemoryError: unable to create new native thread
        at java.lang.Thread.start0(Native Method)
        at java.lang.Thread.start(Thread.java:597)
        at com.sun.jndi.ldap.Connection.<init>(Connection.java:215)
        at com.sun.jndi.ldap.LdapClient.<init>(LdapClient.java:118)
        at com.sun.jndi.ldap.LdapClient.getInstance(LdapClient.java:1580)
        at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2652)
        at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:293)
        at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
        at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193)
        at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:136)
        at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:66)
        at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
        at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
        at javax.naming.InitialContext.init(InitialContext.java:223)
        at javax.naming.ldap.InitialLdapContext.<init>(InitialLdapContext.java:134)

I am using a 64 bit OS. I increased the -Xmx and -Xms options. This appears to be a workaround and the JVM may stop functioning in the future. Please Suggest an alternative way to handle these issues.

Regards, Satti

user1235038
  • 7
  • 1
  • 2
  • What's your present and past -Xmx? – sgowd Mar 06 '12 at 13:05
  • Check this SO question: http://stackoverflow.com/questions/3500773/java-lang-outofmemoryerror-unable-to-create-new-native-thread – Juraj Mar 06 '12 at 13:07
  • 4
    The alternative way is to search for a memory leak and patch it. But you disclosed far too little info to give any clue. – MaDa Mar 06 '12 at 13:07

1 Answers1

1

Find the memory leak(s)! Use a profiler on you application to see if you are leaking memory. Either the code is ok and your app just needs more memory to support the load, either you are leaking memory and even by increasing max heap size, eventually you will see thopse exceptions again, just a little bit later than previously.

Guillaume Polet
  • 47,259
  • 4
  • 83
  • 117