#!/usr/sbin/dtrace -qs /* Program: Print object allocation statistics Author: Matty < matty91 at gmail dot com > Current Version: 1.0 Date: 8-29-2007 Revision History: Version 1.0 - initial release License: The contents of this file are subject to the terms of the Common Development and Distribution License, Version 1.0 only (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at Docs/cddl1.txt or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. Purpose: Shows the Java stack frames that are responsible for object allocations. Sample output: $ whoallocatebybytes.d libjvm.so`__1cNSharedRuntimeTdtrace_object_alloc6FpnHoopDesc__i_+0x4f dtrace_object_alloc Runtime1 stub MyTest.foo()V* Test.main([Ljava/lang/String;)V StubRoutines (1) 57062640 */ hotspot*:::object-alloc { @objects[jstack(20,2048)] = sum(arg3); }