huanwei commented on a change in pull request #393: Polish the default JVM
options for namesrv and broker
URL: https://github.com/apache/rocketmq/pull/393#discussion_r209217103
##########
File path: distribution/bin/runserver.sh
##########
@@ -37,7 +37,16 @@ export CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH}
# JVM Configuration
#===========================================================================================
# Get the max heap used by a jvm, which used all the ram available to the
container.
-MAX_POSSIBLE_HEAP=$(java -XX:+UnlockExperimentalVMOptions -XX:MaxRAMFraction=1
-XshowSettings:vm -version |& awk '/Max\. Heap Size \(Estimated\): [0-9KMG]+/{
print $5}' | gawk -f to_bytes.gawk)
+MAX_POSSIBLE_HEAP_STR=$(java -XX:+UnlockExperimentalVMOptions
-XX:MaxRAMFraction=1 -XshowSettings:vm -version |& awk '/Max\. Heap Size
\(Estimated\): [0-9KMG]+/{ print $5}')
Review comment:
@XiaoZYang `|&` is shorthand for `2>&1 |`. I did the tests on my Ubuntu and
CentOS, it works well. Seems MacOS bash does not recognize `&` .
Now it should be compatible with MacOS, I did the test on my Mac:
```
huandeMacBook-Pro:huanwei huan$ java -XX:+UnlockExperimentalVMOptions
-XX:MaxRAMFraction=1 -XshowSettings:vm -version 2>&1 | awk '/Max\. Heap Size
\(Estimated\): [0-9KMG]+/{ print $5}'
7.11G
```
Thanks for your finding. 👍
Obviously MacOS does not recognize `&`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services