나는 c3p0 연결 관리자를 닫을 때이 코드를 가지고 있습니다. 아무런 메시지도 메모리 누수의 원인이되는 스레드가 있음을 보여줍니다. 하지만 내 응용 프로그램을 다시 배포 할 때 내 perm gen memory가 계속 증가합니다. tomcat 재배포 금지 gen 공간
Oct 19, 2016 11:05:48 AM org.springframework.context.support.AbstractApplicationContext doClose
INFO: Closing WebApplicationContext for namespace 'dispatcherServlet-servlet': startup date [Wed Oct 19 10:41:03 PHT 2016]; parent: Root WebApplicationContext
2016-10-19 11:05:48 - [INFO ] CRMContextListener - Trying to Close
2016-10-19 11:05:53 - [INFO ] CRMContextListener - Close Success
Oct 19, 2016 11:05:53 AM org.springframework.context.support.AbstractApplicationContext doClose
INFO: Closing Root WebApplicationContext: startup date [Wed Oct 19 10:40:53 PHT 2016]; root of context hierarchy
Oct 19, 2016 11:05:53 AM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: A web application registered the JBDC driver [oracle.jdbc.OracleDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Oct 19, 2016 11:06:03 AM org.apache.catalina.core.StandardContext stop
INFO: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/crmdev] has not been started
Oct 19, 2016 11:06:04 AM org.apache.catalina.startup.HostConfig checkResources
INFO: Undeploying context [/crmdev]
이
은public void contextDestroyed(ServletContextEvent sce) {
logger.info("Trying to Close");
for (Object o : C3P0Registry.getPooledDataSources()) {
try {
((PooledDataSource) o).close();
} catch (Exception e) {
logger.info("No thread was open...");
}
}
logger.info("Close Success");
}
그리고 여기가 C3P0
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="oracle.jdbc.driver.OracleDriver" />
<property name="jdbcUrl" value="jdbc:oracle:thin:@sph-pdc-vm 1042:1521:DEV" />
<property name="user" value="TSW" />
<property name="password" value="TSW2015#" />
<property name="minPoolSize" value="2" />
<property name="maxPoolSize" value="20" />
<property name="initialPoolSize" value="5" />
<property name="testConnectionOnCheckin" value="true" />
<property name="idleConnectionTestPeriod" value="100" />
<property name="maxIdleTimeExcessConnections" value="5" />
<property name="maxStatementsPerConnection" value="10" />
<property name="acquireIncrement" value="1" />
<property name="statementCacheNumDeferredCloseThreads" value="1" />
<property name="acquireRetryAttempts" value="2" />
<property name="acquireRetryDelay" value="2000" />
</bean>
풀링 된 연결은 PermGen 공간이 아닌 힙에 저장됩니다. PermGen은 연결 풀 누출이 아니라, 애플리케이션을 Tomcat에 다시 배포하기 때문에 소모됩니다. – SimY4
permgen이 증가하는 것이 정상입니까? –
개발하는 동안 PermGen을 늘려야 할 수도 있습니다. 왜냐하면 개발하는 동안 많은 재배치를 수행 할 것이기 때문입니다. 그러나 제작 과정에서 엄청난 PermGen이 필요하지 않습니다. – SimY4