This is an automated email from the ASF dual-hosted git repository.

chengzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 1ea185444ff update doc for antlr memory usage in JDBC adapter (#36614)
1ea185444ff is described below

commit 1ea185444ff96c7fd67a7962652f560c37296455
Author: Zhengqiang Duan <duanzhengqi...@apache.org>
AuthorDate: Thu Sep 18 14:17:21 2025 +0800

    update doc for antlr memory usage in JDBC adapter (#36614)
---
 README.md                                                          | 3 +++
 README_ZH.md                                                       | 3 +++
 docs/document/content/user-manual/shardingsphere-jdbc/_index.cn.md | 3 +++
 docs/document/content/user-manual/shardingsphere-jdbc/_index.en.md | 3 +++
 4 files changed, 12 insertions(+)

diff --git a/README.md b/README.md
index e62b270fe2f..4634f49d18c 100644
--- a/README.md
+++ b/README.md
@@ -169,6 +169,9 @@ With the client end connecting directly to the database, it 
provides services in
 
 :link: For more details, follow this [link to the official 
website](https://shardingsphere.apache.org/document/current/en/overview/#shardingsphere-jdbc).
 
+> **Note**: When using ShardingSphere-JDBC adapter, pay attention to your 
application's memory configuration. Antlr uses an internal cache to improve 
performance during SQL parsing. If your application has too many SQL templates, 
the cache will continue to grow, occupying a large amount of heap memory.
+According to feedback from the ANTLR official 
[issue#4232](https://github.com/antlr/antlr4/issues/4232), this issue has not 
yet been optimized. When connecting your application to ShardingSphere-JDBC, it 
is recommended to set a reasonable heap memory size using the `-Xmx` parameter 
to avoid OOM errors caused by insufficient memory.
+
 ### ShardingSphere-Proxy
 
 <hr>
diff --git a/README_ZH.md b/README_ZH.md
index c30b4c19564..3e259e9019a 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -141,6 +141,9 @@ Apache ShardingSphere 由 JDBC、Proxy 这 2 款既能够独立部署,又支
 
 :link: 
更多信息请参考[官方网站](https://shardingsphere.apache.org/document/current/cn/overview/#shardingsphere-jdbc)。
 
+> **注意**:使用 ShardingSphere-JDBC 接入端时,需特别关注应用的内存配置。由于 Antlr 在 SQL 
解析过程中,会使用内部缓存来提升性能,如果应用的 SQL 模板数量过多,则会导致缓存不断增长,占用大量堆内存。
+根据 ANTLR 官方 [issue#4232](https://github.com/antlr/antlr4/issues/4232) 
的反馈,目前该问题尚未得到优化,应用接入 ShardingSphere-JDBC 时,建议通过 `-Xmx` 参数设置合理的堆内存大小,避免因内存不足导致的 
OOM。
+
 ### ShardingSphere-Proxy
 
 <hr>
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/_index.cn.md 
b/docs/document/content/user-manual/shardingsphere-jdbc/_index.cn.md
index c7d777fb048..a95ff093ee7 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/_index.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/_index.cn.md
@@ -19,3 +19,6 @@ ShardingSphere-JDBC 提供了 2 种配置方式,用于不同的使用场景。
 同理,如果前一个规则是面向表聚合的,下一个规则在配置表时,则需要使用前一个规则配置的聚合后的逻辑表名称。
 
 
更多使用细节请参见[使用示例](https://github.com/apache/shardingsphere/tree/master/examples/shardingsphere-jdbc-example-generator)。
+
+> **注意**:使用 ShardingSphere-JDBC 接入端时,需特别关注应用的内存配置。由于 Antlr 在 SQL 
解析过程中,会使用内部缓存来提升性能,如果应用的 SQL 模板数量过多,则会导致缓存不断增长,占用大量堆内存。
+根据 ANTLR 官方 [issue#4232](https://github.com/antlr/antlr4/issues/4232) 
的反馈,目前该问题尚未得到优化,应用接入 ShardingSphere-JDBC 时,建议通过 `-Xmx` 参数设置合理的堆内存大小,避免因内存不足导致的 
OOM。
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/_index.en.md 
b/docs/document/content/user-manual/shardingsphere-jdbc/_index.en.md
index e7d4fc9b10b..c2017b87338 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/_index.en.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/_index.en.md
@@ -20,3 +20,6 @@ If the previous rule is data source oriented aggregation, the 
next rule needs to
 Similarly, if the previous rule is table oriented aggregation, the next rule 
needs to use the aggregated logical table name configured by the previous rule 
when configuring the table.
 
 Please refer to 
[Example](https://github.com/apache/shardingsphere/tree/master/examples/shardingsphere-jdbc-example-generator)
 for more details.
+
+> **Note**: When using ShardingSphere-JDBC adapter, pay attention to your 
application's memory configuration. Antlr uses an internal cache to improve 
performance during SQL parsing. If your application has too many SQL templates, 
the cache will continue to grow, occupying a large amount of heap memory.
+According to feedback from the ANTLR official 
[issue#4232](https://github.com/antlr/antlr4/issues/4232), this issue has not 
yet been optimized. When connecting your application to ShardingSphere-JDBC, it 
is recommended to set a reasonable heap memory size using the `-Xmx` parameter 
to avoid OOM errors caused by insufficient memory.

Reply via email to