这是我的示例代码。
public void leak()
{
super.superMap = new ConcurrentHashMap<Integer, MemLeak>();
int i=1;
while(true) {
// This put method should be called infinite times
super.superMap.put(i,new MemLeak("test"));
try {
Thread.sleep(10);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
i++;
}
我的问题是,这个put()
应该被称为无限次。但是,当我尝试检查asm
输出时,我可以看到该方法只被调用三次。
public void visitMethodInsn(int opcode, String owner, String name,
String desc) {
super.visitMethodInsn(opcode, owner, name, desc);
// keep a check whether the owner class is Map or ConcurrentHashMap
System.out.println("Method called..."+owner+"\t "+name+"\t "+desc);
}