Fully featured low overhead profiler for Java EE and Java SE platforms.
Easy-to-use performance and memory .NET profiler for Windows, Linux and macOS.
Secure and easy profiling in cloud, containers and clustered environments.
Performance monitoring and profiling of Jenkins, Bamboo, TeamCity, Gradle, Maven, Ant and JUnit.

Classic allocation profiling

How classic allocation profiling works

For applications running on Java 8 - Java 10, the profiler uses bytecode instrumentation. It detects and modifies new instructions in the bytecode, allowing tracking of all Java object creations.

For Java 11 and later, YourKit Java Profiler uses a different, more efficient approach: heap sampling with the smallest possible sampling interval.

Advantages

  1. It provides the maximum level of details including thread information, full stack traces of object creation, and object size.
  2. You can profile object allocations on older Java versions that do not support heap sampling, such as Java 8.
  3. In this mode, the creation of all objects can be tracked without exception, which is not possible with heap sampling due to its probabilistic nature.

Disadvantages

  1. Instrumentation has a higher overhead than heap sampling. Even when the allocation profiling is off, there is a small overhead from calling profiler support code.
  2. Instrumentation increases bytecode size and slows down class loading. In some cases, such as very long Java methods, instrumentation may not be possible if the method's bytecode exceeds the size limit.
  3. In attach mode, a pause occurs on the first attempt to start object allocation profiling because classes loaded before the agent attaches must be instrumented.

Performance overhead

Profiler overhead directly depends on the number of objects for which the profiler records a stack trace. The fewer stack traces the profiler records, the lower the overhead.

YourKit Java Profiler provides options that allow efficient allocation profiling while maintaining moderate performance overhead:

  1. The first option specifies the minimum object size for which an allocation stack trace is always recorded. For example, if the minimum size is set to 4KiB, stack traces will be recorded for the creation of all objects of 4KiB or larger. This ensures that all significant allocations are captured.
  2. But what if the program creates many small objects? For this, there is a second option: "record every N-th object smaller than the minimum size". This option allows collecting statistical data on the creation of small objects.

As a result, with moderate performance impact, we can obtain complete information about all large object allocations and statistical data on small object allocations.

YourKit uses cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content, to analyze our website traffic, and to understand where our visitors are coming from.

By browsing our website, you consent to our use of cookies and other tracking technologies in accordance with the Privacy Policy.