jvmti-bindings 2.2.0

Complete JNI and JVMTI bindings for Rust with zero dependencies by default. Build JVM agents in pure Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# JVMTI and JNI Pitfalls

This guide highlights common footguns when writing JVM agents.

1. Enabling events without the required capability yields silent failures.
2. Calling JNI from `GarbageCollectionStart/Finish` is forbidden.
3. Holding JVM monitors while calling JVMTI can deadlock the VM.
4. `JNIEnv` is thread-local and invalid on other threads.
5. Callback order can differ across JVM implementations.
6. `ClassFileLoadHook` can be called concurrently and very early.
7. Allocating memory in hot callbacks can cause severe pauses.
8. Mis-sized `new_class_data_len` corrupts class loading.
9. JVMTI buffers must be deallocated with `Deallocate`, not `free`.
10. Some events are disabled by default for performance reasons.