-
Notifications
You must be signed in to change notification settings - Fork 961
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't track object creation #356
Comments
I hate to bring you the bad news but BTrace is not an optimal tool for this. You would need something operating at the native level and completely off the Java heap. This kind of instance tracking is good only for 'hello world' like applications :/ Regarding your problem here - can you first try having just the print statement in the probe method to rule out any reflection related problems? If you still won't see the expected output, run BTrace in debug mode and/or collect the instrumented class files and attach the outputs to this issue. Thanks! |
Thanks Jaroslav Bachorik! I will have a try and provide feedback. |
Any progress here? |
Hi Jaroslav Bachorik, Sorry for late...Will try and provide feedback. Thanks, |
Hi Jaroslav Bachorik, Without reflection code, it can work. Regarding reflection part, let me do more test. Thanks for ur kindly guide. Code: @btrace } Thanks, |
Any updates on this? |
Hi Jaroslav Bachorik, Sorry for late due to other tasks...Will try and provide feedback. Thanks, |
Hi Jaroslav Bachorik, I just tried Oracle JDK8, it can work with reflection. Actually we are using other JDK distributions, let me try it as well, maybe it is interim issue which can't reproduced. Thanks for ur kindly follow up. BTrace code: import com.sun.btrace.annotations.; @btrace
} Thanks, |
Hi Jaroslav Bachorik, I tried in our JDK distributions (JDK7), seems reflection can't work. Seems instrumented classes and probe output was not generated. Could u please help to have a check? Thx! The following is debug message: ~/rzhang/BTrace/bin> ./btrace -v -o a.txt -d . 16343 BHello.java Thanks, |
Stale issue message |
Hi All,
I refer to #252 to do a hello world to track all object allocation, and I use the following code in #252.
BTrace code version: 1.3.11
Expected behavior: It will print my test message "Roytest" for every new object allocation.
Actually behavior: It doesn't print anything.
I did a simple test, use "java.util.HashMap" to replace "+java.lang.Object", it will print related message like below:
roytest
java.util.HashMap 64
Btrace code:
import com.sun.btrace.annotations.;
import static com.sun.btrace.BTraceUtils.;
@btrace
public class BHello {
@OnMethod(clazz = "+java.lang.Object", method = "")
public static void onNewThing(@self Object o, @ProbeClassName String pcn) {
println("Roytest");
Class objectClass = Reflective.classOf(o);
String objectClassString = Reflective.name(objectClass);
}
Really appreciated ur help in advance!
My task: track big object allocation and its stacktrace, it would be great if you could provide comment on it as well :)
Thanks,
Roy
The text was updated successfully, but these errors were encountered: