https://github.com/marschall/object-size
Uses IterateOverObjectsReachableFromObject to compute java object size
https://github.com/marschall/object-size
java jvmti object-graph object-si
Last synced: 3 months ago
JSON representation
Uses IterateOverObjectsReachableFromObject to compute java object size
- Host: GitHub
- URL: https://github.com/marschall/object-size
- Owner: marschall
- Created: 2024-07-27T14:22:25.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-07-28T14:15:24.000Z (10 months ago)
- Last Synced: 2025-01-16T02:44:47.285Z (5 months ago)
- Topics: java, jvmti, object-graph, object-si
- Language: C
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Java Object Graph Size
======================Uses [IterateOverObjectsReachableFromObject](https://docs.oracle.com/en/java/javase/21/docs/specs/jvmti.html#IterateOverObjectsReachableFromObject) to compute the size of an object and all the objects reachable from it.
> During the execution of this function the state of the heap does not change: no objects are allocated, no objects are garbage collected, and the state of objects (including held values) does not change. As a result, threads executing Java programming language code, threads attempting to resume the execution of Java programming language code, and threads attempting to execute JNI functions are typically stalled.
If JFR is present we additionally generate a JFR event allowing you to assess the overhead.
Usage
-----The native agent has to be loaded using a JVM option.
```
-agentpath:/path/to/libobject-size-agent.so
```Then it can be used from Java
```java
ObjectSizeCalculator.getInstance().getObjectSize(myObject);
```