Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@kailbin
Copy link

@kailbin kailbin commented Oct 30, 2018

con.prepareStatement 在 MySQL 驱动下,会注册到 ConnectionImpl 的 openStatements 集合里面,除非显式关闭 Statement 或者 Connection,否则Connection会一直保存 Statement 的引用。

因为 DataAccessImpl.getPreparedStatementCreator 里面创建了两次 PreparedStatement,在 tomcat-jdbc 下只会关闭一次,导致每次执行SQL 语句之后 openStatements 都会引用两个 PreparedStatement,但是关闭的时候只关闭了一个,造成内存泄露。

目前只发现 tomcat-jdbc 下有该问题,因为 Spring Boot 默认使用的是 tomcat-jdbc,Rose 集成Spring Boot 之后,不注意的话,常常会出现该问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.