从LeakTraceElement中检索行号

时间:2017-05-08 10:28:34

标签: java memory-leaks stack-trace line-numbers leakcanary

我正在使用LAHF来检测内存泄漏。为了跟踪事件,我将StackTraceElement转换为StackTraceElement,如LeakCanary所示。

"LeakCanary, then what? Nuking Nasty Memory Leaks by Pierre-Yves Ricau"

我想将行号传递给StackTraceElement(String cls, String method, String file, int line) { /* ... */ } 构造函数:

<?php
if(isset($_POST['add_new']))
{
    $name = $_POST['name'];
    $email = $_POST['email'];
    $phone = $_POST['phone'];
    $field = $_POST['field'];
    $message = $_POST['message'];

    $comment1 =array($_POST['comment1'],$s_date);

    $comment2 = $_POST['comment2'];
    $status = $_POST['status'];
    $s_date = date('Y-m-d');
    $interested_in = $_POST['interested_in'];
    $academic_details = $_POST['academic_details'];
    $city = $_POST['city'];

    $sql = "insert into enquires2(name,email,phone,field,message,comment1,comment2,status,s_date,interested_in,academic_details,city,admin_idd)values('$name','$email','$phone','$field','$message','$comment1','$comment2','$status','$s_date','$interested_in','$academic_details','$city','$admin_id')";
    $result = mysqli_query($link,$sql);
    if($result == true)
    {
      $msg .= "<p style='color:green;'>You are successfully add new enquiry</p>";
    }
    else
    {
      $msg .= "<p style='color:red;'>Error!</p>";
    }
}
?>

如何从LeakCanary中检索行号

1 个答案:

答案 0 :(得分:0)

我刚刚玩了一点,在做了一些挖掘之后,看起来这些信息在运行时并不是直接可用的。

How to get line number of an instance variable from a java object during runtime