Skip to content

Example code for launching a JVM from C that supports NativeMemoryTracking and -Xss

License

Notifications You must be signed in to change notification settings

areese/launch_jvm_from_jni

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jnivm

This is example code for how to "correctly" start the JVM via JNI. I had an issue where -Xss and -XX:NativeMemoryTracking=<detail|summary> wasn't working. Digging through the launcher code and asking Oracle led to the fix which is what this code outlines.

Basically you need to scan for these 2 options in the command line, and if you see them set up things before you start the jvm so it can use them. You also must call the jvm functions via function pointers from loading the library dynamically and not from linking with it.

https://docs.oracle.com/javase/8/docs/technotes/guides/vm/nmt-8.html http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html

About

Example code for launching a JVM from C that supports NativeMemoryTracking and -Xss

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published