Help on @Location with Kind = NEW / NEWARRAY

  2 posts   Feedicon  
Replies: 1 - Last Post: November 14, 2011 07:59
by: Jaroslav Bachorik
showing 1 - 2 of 2
 
Posted: November 09, 2011 16:17 by thmauch
I would like to trace allocations in my application.
My sample application has this function:

void f() {
char[] c = new char[10];
int[] i = new int[10];
String s = new String("abc");
Object o = new Object();
}

My probe method is annotated like this:

@OnMethod(
clazz = "eval.btrace.runner.TraceRunner",
method = "/.*/",
location = @Location(value = Kind.NEWARRAY, clazz = "int")
//location = @Location(value = Kind.NEWARRAY, clazz = "/.+/")
//location = @Location(value = Kind.NEW, clazz = "java.lang.Object")
//location=@Location(value=Kind.NEW, clazz="/.+/")
)

If run I like this, my method gets called if for allocation of int[] arrays.
I I try however all the other commented location statements, nothing happens.
Is there a possibility to trace all array locations as I tried using regular expression, is this supported?
I was not able to get called for a object creation. How should I use Kind.NEW?

I was looking for some detailled documentation of the @Location feature but was not able to find it.

Can you help me?

Thanks,
Thomas
 
Posted: November 14, 2011 07:59 by Jaroslav Bachorik
Hi Thomas,
the @Location.clazz attribute does not support wildcard type specification. If you think it would be useful feel free to file a RFE for such functionality.

I've checked the location = @Location(value = Kind.NEW, clazz = "java.lang.Object") behavior as this kind of location specification should work ok. And, indeed, it does. Please, double check your code for any typos etc.

Regards,

-JB-
Replies: 1 - Last Post: November 14, 2011 07:59
by: Jaroslav Bachorik
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close