gavinchou commented on code in PR #34354:
URL: https://github.com/apache/doris/pull/34354#discussion_r1596983809


##########
be/src/util/jni-util.cpp:
##########
@@ -204,6 +207,49 @@ Status JniLocalFrame::push(JNIEnv* env, int max_local_ref) 
{
     return Status::OK();
 }
 
+void JniUtil::parse_max_heap_memory_size_from_jvm(JNIEnv* env) {
+    // The start_be.sh would set JAVA_OPTS
+    std::string java_opts = getenv("JAVA_OPTS") ? getenv("JAVA_OPTS") : "";
+    std::istringstream iss(java_opts);
+    std::string opt;
+    while (iss >> opt) {
+        if (opt.find("-Xmx") == 0) {
+            std::string xmxValue = opt.substr(4);
+            char unit = xmxValue.back();
+            xmxValue.pop_back();
+            long long value = std::stoll(xmxValue);
+            switch (unit) {
+            case 'g':
+            case 'G':
+                max_jvm_heap_memory_size_ = value * 1024 * 1024 * 1024;
+                break;
+            case 'm':
+            case 'M':
+                max_jvm_heap_memory_size_ = value * 1024 * 1024;
+                break;
+            case 'k':
+            case 'K':
+                max_jvm_heap_memory_size_ = value * 1024;
+                break;
+            default:
+                max_jvm_heap_memory_size_ = value;
+                break;
+            }
+        }
+    }
+    LOG(INFO) << "the max_jvm_heap_memory_size_ is " << 
max_jvm_heap_memory_size_;

Review Comment:
   log fatal and exit if max_jvm_heap_memory_size_ is zero



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to