0
我有一臺服務器在jav上運行,啓動時100MB RAM左右(從查看進程管理器獲得的信息)。但是,當客戶端連接到它傳輸一個大文件時,內存使用量會增加到160MB左右,我得到下面的錯誤。我嘗試設置-Xmx128m,-Xmx256m,-Xmx512m,-Xmx1024m無濟於事。我應該怎麼做才能防止這種情況發生。這隻發生在客戶端試圖從服務器獲取大文件時Java OutOfMemoryException無法創建新的本機線程
java.lang.OutOfMemoryError: unable to create new native thread
java.lang.Thread.start0(Native Method)
java.lang.Thread.start(Unknown Source)
com.sun.jndi.ldap.Connection.<init>(Unknown Source)
com.sun.jndi.ldap.LdapClient.<init>(Unknown Source)
com.sun.jndi.ldap.LdapClient.getInstance(Unknown Source)
com.sun.jndi.ldap.LdapCtx.connect(Unknown Source)
com.sun.jndi.ldap.LdapCtx.<init>(Unknown Source)
com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(Unknown Source)
com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(Unknown Source)
com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(Unknown Source)
com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(Unknown Source)
javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
javax.naming.InitialContext.init(Unknown Source)
javax.naming.ldap.InitialLdapContext.<init>(Unknown Source)
可能重複的[Java:無法創建新的本地線程](http://stackoverflow.com/questions/5253072/java-unable-to-create-new-native-thread) – NPE
可能重複[java。 lang.OutOfMemoryError:無法創建新的本地線程](http://stackoverflow.com/questions/3500773/java-lang-outofmemoryerror-unable-to-create-new-native-thread) – assylias
在我看來,設置-Xmx在錯誤的地方,如果-Xmx1024M被設置,RAM使用增長超過700M? – Betlista