MyBatis version

3.5.5

Database vendor and version

Mysql

Test case or example project

====

SqlSession sqlSession = sqlSessionFactory.openSession(); BasicMapper mapper = sqlSession.getMapper(BasicMapper.class); for (int i = 0; i < 2000000; i++) { System.out.println(mapper.queryName(i)); } sqlSession.commit();

====

@CacheNamespace(blocking = true) public interface BasicMapper { @Select("select value from demo where id = #{id}") String queryName(@Param("id") int id); }

Steps to reproduce

Running test case. Set jvm options -Xms20m -Xmx20m(this option just make result more easy to appear) To make a compare.we can set blocking = flase then see whether OutOfMemoryErro happen.

Expected result

no error.

Actual result

Programe has been OutOfMemoryError.

Comment From: harawata

This may be a duplicate of #1261 .