Trace object allocation flag proposal
David Holmes
David.Holmes at oracle.com
Tue Dec 14 23:58:09 PST 2010
Hi Xiaobin,
The problem with tracing like this is that to be useful the tracing must
be unobtrusive and be able to handle getting called millions of times
(which is what will happen in those GC scenarios you describe). The
sheer volume of data generated as you suggest below would overwhelm the
app and be pretty hard to work with.
Per-thread statistics of particular types (or of objects larger than a
certain size) might be more useful, with a dump able to be requested
on-demand.
But I think you'd need to be able to combine this with heap dump info to
be useful.
It really depends on exactly what info you want to be able to deduce:
simple number of objects of given types, hot allocation sites, hot
threads, ...
Cheers,
David
Xiaobin Lu said the following on 12/15/10 17:07:
> Hi folks,
>
> I would like to propose a way to trace object allocation on Linux. On
> Solaris, we have DTrace which is pretty nice. But on Linux, it is almost
> impossible to do so. Correct me if I am wrong here.
>
> So I am thinking to add a manageable VM flag and let's call it
> TraceObjectAllocation. When enabled, we can output something like:
>
> thread id: 10 class name: java/lang/reflect/Method size:
> 80 bytes
> thread id: 10 class name: [Ljava/lang/Class;
> size: 16 bytes
> thread id: 10 class name: [C
> size: 56 bytes
> thread id: 10 class name: java/lang/reflect/Method size:
> 80 bytes
> thread id: 10 class name: [Ljava/lang/Class; size:
> 16 bytes
>
> As you could imagine, this could be very useful to keep track of object
> allocation behavior in the app. Some smart tool can take advantage of
> this to print a histogram (like top 10 hot allocations) of object
> allocation. I would like to know your thoughts and suggestions on this.
>
> I have a detailed proposal on this attached in PDF file.
>
> Thanks,
>
> -Xiaobin
>
>
More information about the hotspot-runtime-dev
mailing list