com.squareup.leakcanary.RefWatcher.gone()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(59)

本文整理了Java中com.squareup.leakcanary.RefWatcher.gone方法的一些代码示例,展示了RefWatcher.gone的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RefWatcher.gone方法的具体详情如下:
包路径:com.squareup.leakcanary.RefWatcher
类名称:RefWatcher
方法名:gone

RefWatcher.gone介绍

暂无

代码示例

代码示例来源:origin: square/leakcanary

if (gone(reference)) {
 return DONE;
if (!gone(reference)) {
 long startDumpHeap = System.nanoTime();
 long gcDurationMs = NANOSECONDS.toMillis(startDumpHeap - gcStartNanoTime);

代码示例来源:origin: com.netease.cloudmusic.leakwatcher/leak-watcher

@SuppressWarnings("ReferenceEquality") // Explicitly checking for named null.
Retryable.Result ensureGone(final KeyedWeakReference reference, final long watchStartNanoTime) {
 long gcStartNanoTime = System.nanoTime();
 long watchDurationMs = NANOSECONDS.toMillis(gcStartNanoTime - watchStartNanoTime);
 removeWeaklyReachableReferences();
 if (debuggerControl.isDebuggerAttached()) {
  // The debugger can create false leaks.
  return RETRY;
 }
 if (gone(reference)) {
  return DONE;
 }
 gcTrigger.runGc();
 removeWeaklyReachableReferences();
 if (!gone(reference)) {
  long startDumpHeap = System.nanoTime();
  long gcDurationMs = NANOSECONDS.toMillis(startDumpHeap - gcStartNanoTime);
  File heapDumpFile = heapDumper.dumpHeap();
  if (heapDumpFile == RETRY_LATER) {
   // Could not dump the heap.
   return RETRY;
  }
  long heapDumpDurationMs = NANOSECONDS.toMillis(System.nanoTime() - startDumpHeap);
  heapdumpListener.analyze(
    new HeapDump(heapDumpFile, reference.key, reference.name, excludedRefs, watchDurationMs,
      gcDurationMs, heapDumpDurationMs));
 }
 return DONE;
}

相关文章

微信公众号

最新文章

更多