Jump to content
Excelsior Forums
idle

JVM arguments during execution

Recommended Posts

Hi,

How do I pass JVM arguments to the created executable (e.g. -Xms, -Xss), during execution? Another process is calling my app via ProcessBuilder/Runtime.exec, and it needs to pass these dynamic arguments to it.

 

I've tried doing <myapp> -Xms:1024M -Xss:2M, but it doesn't seem to take, since I queried the app and it says that the app is still using the system default value for thread stack size.

Thanks.

Edited by idle
more detail

Share this post


Link to post
Share on other sites
25 minutes ago, AlexandrFIlatov said:

Hello,

You can find all the information you are interested in at Excelsior JET User's Guide, section "Application Considerations", subsection "Java system properties" at https://www.excelsior-usa.com/doc/jet/jetw011.html#0308.

Regards,

Excelsior Support Team

Thanks so much for the quick reply, Alexandr :)

I went over the section, specifically the "Standard Runtime Options" and it did say the "-xss" argument is recognized. Just to be sure, it's saying that if I pass the argument, the app will have custom the thread stack size set, correct? 

I use the following code snippet to query the -xss parameter from the JVM

		RuntimeMXBean rbean = ManagementFactory.getRuntimeMXBean();
		List<String> args = rbean.getInputArguments();

by looping through the args and parsing the value for "-xss". When I do this on my JET-compiled app, it doesn't find an arg containing "-xss", which is expected if -xss is not set or isn't on the args list. 

 

I'm guessing, since you're saying JET will run the app with the -xss set correctly, that either RuntimeMXBean isn't functioning correctly when ran from a JET-comiled app or JET does something different under the hood, and, therefore, I shouldn't worry about it at all?

Thanks again.

Share this post


Link to post
Share on other sites

Being a compliant Java SE platform implementation, Excelsior JET in particular supports the Management API, the JMX (Java Management Extensions) technology, and SNMP. However, there is a number of HotSpot-specific management and monitoring features in the reference implementation. They are not supported. Unforunately, class RuntimeMXBean is one of them at the moment. 

You can find more information about supported JMX API by Excelsior JET here: https://www.excelsiorjet.com/kb/36/howto-monitor-and-manage-your-optimized-applications-using-jmx-or-snmp.

 

Anyway, Excelsior JET successfully recognizes options "-Xss" and "-Xmx" passed through JETVMPROP, but RuntimeMXBean.getInputArguments() returns empty String[], so your approach does not give you desired results when compiled by Excelsior JET. Note, that on Windows and OS X stack size for main thread is hardwired by compiler into executable using option -stacklimit from project file as required by executable binary format.

Regards,

Excelsior Support Team

Share this post


Link to post
Share on other sites

Yet another great and informative reply. I've managed to test it properly and confirm that the flag is indeed working, and also found a nice workaround in the process. Thanks again!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×