TeslaCN commented on issue #28069:
URL: 
https://github.com/apache/shardingsphere/issues/28069#issuecomment-1682027931

   Thanks for your feedback. I've confirmed the memory leak in 
ShardingSphere-JDBC.
   
   Running test with `-Xms512m -Xmx512m -XX:+HeapDumpOnOutOfMemoryError`
   ```java
       @Test
       void select1() throws SQLException {
           for (int i = 0; i < 10000000; i++) {
               try (Connection connection = 
getShardingSphereDataSource().getConnection(); Statement statement = 
connection.createStatement()) {
                   statement.execute("select 1");
               }
           }
       }
   ```
   
   ```
   diff --git 
a/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/statement/ShardingStatementTest.java
 
b/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/statement/ShardingStatementTest.java
   index cd8db1a672c..abf7869d37c 100644
   --- 
a/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/statement/ShardingStatementTest.java
   +++ 
b/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/statement/ShardingStatementTest.java
   @@ -35,6 +35,15 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
    
    class ShardingStatementTest extends AbstractShardingDriverTest {
        
   +    @Test
   +    void select1() throws SQLException {
   +        for (int i = 0; i < 10000000; i++) {
   +            try (Connection connection = 
getShardingSphereDataSource().getConnection(); Statement statement = 
connection.createStatement()) {
   +                statement.execute("select 1");
   +            }
   +        }
   +    }
   +    
        @Test
        void assertGetGeneratedKeys() throws SQLException {
            String sql = "INSERT INTO t_order_item(order_id, user_id, status) 
VALUES (%d, %d, '%s')";
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to