This repository provides a Java agent that uses the java.lang.instrument API and ASM bytecode manipulation library to instrument every heap allocation in a Java program. It rewrites bytecodes such as NEW, NEWARRAY, ANEWARRAY, MULTIANEWARRAY, and reflection-based Array.newInstance() to insert pre- and post-allocation hooks. A user-defined 'Sampler' callback receives allocation details including count, type descriptor, object reference, and object size. Additionally, it supports constructor-level instrumentation via ConstructorInstrumenter, allowing callbacks on specific class instantiations. The agent is self-contained, handles reentrancy, caches object sizes, and carefully manages bootstrap classloader concerns through a generated Bootstrap class that dynamically appends the agent JAR to the bootclasspath. The build system uses Bazel with custom rules for assembling the agent jar, including ASM relocation via JarJar to avoid classpath conflicts, and stripping of build metadata. The codebase demonstrates expert-level bytecode transformation, robust error handling, and thorough testing covering many edge cases (e.g., multidimensional arrays, lambda allocations, metaspace exhaustion).