Skip to content

"ThreadLocal" variables should be cleaned up correctly #2509

Closed
@Oliverwqcwrw

Description

@Oliverwqcwrw

MyBatis version

3.5.9

Test case or example project

Steps to reproduce

In org.apache.ibatis.session.SqlSessionManager#close

localSqlSession.set(null); to remove the value might keep the reference to this pointer in the map, which can cause memory leak in some scenarios. Using remove() is safer to avoid this issue.

reference java-memory-leaks

Expected result

localSqlSession.remove();

Actual result

Metadata

Metadata

Assignees

Labels

polishingImprove a implementation code or doc without change in current behavior/content

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions