A Java agent and library for measuring actual object memory usage, including JVM overhead, across multiple Java versions.
Jamm is a Java library and agent that measures the actual memory usage of Java objects, including JVM overhead. It provides the `MemoryMeter` tool to help developers understand the true memory footprint of their objects, which is essential for performance tuning and avoiding memory leaks in Java applications.
Java developers and performance engineers who need to analyze and optimize memory consumption in their applications, particularly those working with complex object graphs or large-scale systems.
Jamm offers accurate memory measurement across multiple Java versions (8, 11, 17) and JVM configurations, with support for various measurement strategies and flexible filtering options, making it a reliable tool for deep memory analysis.
Java Agent for Memory Measurements
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports Instrumentation, Unsafe, and Specification strategies, with Instrumentation being safest when using the Java agent for precise object size estimation across Java 8, 11, and 17.
Can recursively measure entire object graphs with measureDeep, including options to filter classes or ignore references, essential for profiling complex memory footprints.
Allows skipping measurement of specific classes or fields using the @Unmetered annotation or custom filters, providing fine-grained control over memory analysis.
Offers specialized modes (NORMAL, SLAB_ALLOCATION_NO_SLICE, SLAB_ALLOCATION_SLICE) for accurate ByteBuffer measurements in slab-based allocations, critical for buffer management scenarios.
Version 0.4.0 introduced significant breaking changes, such as removing constructors and static methods in favor of a Builder pattern, requiring code updates and migration efforts.
Assumes and only tested with HotSpot JVM; explicitly not compatible with other JVMs like OpenJ9, limiting its use in diverse or legacy environments.
Under JPMS, reflection may be blocked, requiring add-exports or add-opens JVM arguments for accurate crawling, which can be cumbersome and error-prone in production setups.
Without the -javaagent, strategies like Unsafe may fail for records or hidden classes (e.g., lambdas), and Specification has known issues with certain JVM arguments, reducing reliability.