Skip to content

Can't track object creation #356

@RoySunnySean007

Description

@RoySunnySean007

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);

        if (Strings.compareTo(pcn, objectClassString) == 0) {
            print(pcn);
            print('\t');
            println(Strings.str(sizeof(o)));
            
        }
}

}

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions