-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
922 lines (547 loc) · 28.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme="auto">
<head>
<meta charset="UTF-8">
<link rel="apple-touch-icon" sizes="76x76" href="/img/logo.svg">
<link rel="icon" href="/img/logo.svg">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="theme-color" content="#2f4154">
<meta name="description" content="">
<meta name="author" content="aprz512">
<meta name="keywords" content="">
<title>二手程序员</title>
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.5.3/css/bootstrap.min.css" />
<!-- 主题依赖的图标库,不要自行修改 -->
<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_ba1fz6golrf.css">
<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_kmeydafke9r.css">
<link rel="stylesheet" href="/css/main.css" />
<!-- 自定义样式保持在最底部 -->
<script id="fluid-configs">
var Fluid = window.Fluid || {};
var CONFIG = {"hostname":"lyldalek.top","root":"/","version":"1.8.11","typing":{"enable":true,"typeSpeed":100,"cursorChar":"_","loop":false},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"right","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":200}},"copy_btn":true,"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":true,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":"oWSVw2w2LW7MdhWmyHAsgyH6-MdYXbMMI","app_key":"FllNdPfQPCLcrJVVXHGyakPQ","server_url":null}},"search_path":"/local-search.xml"};
</script>
<script src="/js/utils.js" ></script>
<script src="/js/color-schema.js" ></script>
<meta name="generator" content="Hexo 5.4.0"></head>
<body>
<header style="height: 100vh;">
<nav id="navbar" class="navbar fixed-top navbar-expand-lg navbar-dark scrolling-navbar">
<div class="container">
<a class="navbar-brand"
href="/"> <strong>二手程序员</strong> </a>
<button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<div class="animated-icon"><span></span><span></span><span></span></div>
</button>
<!-- Collapsible content -->
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto text-center">
<li class="nav-item">
<a class="nav-link" href="/">
<i class="iconfont icon-home-fill"></i>
首页
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/archives/">
<i class="iconfont icon-archive-fill"></i>
归档
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/categories/">
<i class="iconfont icon-category-fill"></i>
分类
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/tags/">
<i class="iconfont icon-tags-fill"></i>
标签
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/about/">
<i class="iconfont icon-user-fill"></i>
关于
</a>
</li>
<li class="nav-item" id="search-btn">
<a class="nav-link" target="_self" data-toggle="modal" data-target="#modalSearch"> <i
class="iconfont icon-search"></i> </a>
</li>
<li class="nav-item" id="color-toggle-btn">
<a class="nav-link" target="_self"> <i
class="iconfont icon-dark" id="color-toggle-icon"></i> </a>
</li>
</ul>
</div>
</div>
</nav>
<div class="banner" id="banner"
style="background: url('/img/default.png') no-repeat center center;
background-size: cover;">
<div class="full-bg-img">
<div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
<div class="page-header text-center fade-in-up">
<span class="h2" id="subtitle" title="路漫漫其修远兮~">
</span>
</div>
<div class="scroll-down-bar">
<i class="iconfont icon-arrowdown"></i>
</div>
</div>
</div>
</div>
</header>
<main>
<div class="container nopadding-x-md">
<div class="py-5" id="board"
>
<div class="container">
<div class="row">
<div class="col-12 col-md-10 m-auto">
<div class="row mx-auto index-card">
<div class="col-12 col-md-4 m-auto index-img">
<a href="/2022/01/02/blog_bak/Blog/C++/%E8%BF%99%E5%AD%A6JNI%EF%BC%8C%E5%A4%9A%E6%98%AF%E4%B8%80%E4%BB%B6%E7%BE%8E%E4%BA%8B%E5%95%8A/" target="_blank">
<img src="/cover/2.jpg" srcset="/img/loading.gif" lazyload alt="这学JNI,多是一件美事啊">
</a>
</div>
<article class="col-12 col-md-8 mx-auto index-info">
<h1 class="index-header">
<a href="/2022/01/02/blog_bak/Blog/C++/%E8%BF%99%E5%AD%A6JNI%EF%BC%8C%E5%A4%9A%E6%98%AF%E4%B8%80%E4%BB%B6%E7%BE%8E%E4%BA%8B%E5%95%8A/" target="_blank">
这学JNI,多是一件美事啊
</a>
</h1>
<p class="index-excerpt">
<a href="/2022/01/02/blog_bak/Blog/C++/%E8%BF%99%E5%AD%A6JNI%EF%BC%8C%E5%A4%9A%E6%98%AF%E4%B8%80%E4%BB%B6%E7%BE%8E%E4%BA%8B%E5%95%8A/" target="_blank">
JNI的定义JNI全称:Java Native Interface
它是Java本身的一种特性,用来在Java里面调用C/C++代码的。
看下面的一个程序:
12345public static void main(String[] args) throws Exception { PrintStream ps = new PrintStream(new FileOutputStr
</a>
</p>
<div class="index-btm post-metas">
<div class="post-meta mr-3">
<i class="iconfont icon-date"></i>
<time datetime="2022-01-02 00:00" pubdate>
2022-01-02
</time>
</div>
<div class="post-meta mr-3">
<i class="iconfont icon-category"></i>
<a href="/categories/C/">C++</a>
</div>
</div>
</article>
</div>
<div class="row mx-auto index-card">
<div class="col-12 col-md-4 m-auto index-img">
<a href="/2021/08/22/blog_bak/Blog/%E6%8A%98%E8%85%BE/%E7%8A%B6%E6%80%81%E9%97%AE%E9%A2%98/" target="_blank">
<img src="/cover/22.jpg" srcset="/img/loading.gif" lazyload alt="状态问题">
</a>
</div>
<article class="col-12 col-md-8 mx-auto index-info">
<h1 class="index-header">
<a href="/2021/08/22/blog_bak/Blog/%E6%8A%98%E8%85%BE/%E7%8A%B6%E6%80%81%E9%97%AE%E9%A2%98/" target="_blank">
状态问题
</a>
</h1>
<p class="index-excerpt">
<a href="/2021/08/22/blog_bak/Blog/%E6%8A%98%E8%85%BE/%E7%8A%B6%E6%80%81%E9%97%AE%E9%A2%98/" target="_blank">
4月份休假,5月份入职新公司,然后接近4个月没有更新博客了,一来确实是较之前忙了很多倍,二来也是自己懒,总觉得周末还不够自己休息的。
这个周末给自己定的目标就是把博客环境搭建起来,因为我之前一直使用移动硬盘来传博客,但是这个硬盘出了问题,所以就只能重新再搭建一个博客环境。本来是想用 ubuntu 的环境,但是不知道咋回事 ubuntu 也装不上了,想着再搞就要零点了,所以就在 windows 上搭
</a>
</p>
<div class="index-btm post-metas">
<div class="post-meta mr-3">
<i class="iconfont icon-date"></i>
<time datetime="2021-08-22 00:00" pubdate>
2021-08-22
</time>
</div>
<div class="post-meta mr-3">
<i class="iconfont icon-category"></i>
<a href="/categories/%E6%8A%98%E8%85%BE/">折腾</a>
</div>
</div>
</article>
</div>
<div class="row mx-auto index-card">
<div class="col-12 col-md-4 m-auto index-img">
<a href="/2021/06/13/blog_bak/Blog/C++/003-vscode%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA/" target="_blank">
<img src="/cover/13.jpg" srcset="/img/loading.gif" lazyload alt="003-vscode环境搭建">
</a>
</div>
<article class="col-12 col-md-8 mx-auto index-info">
<h1 class="index-header">
<a href="/2021/06/13/blog_bak/Blog/C++/003-vscode%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA/" target="_blank">
003-vscode环境搭建
</a>
</h1>
<p class="index-excerpt">
<a href="/2021/06/13/blog_bak/Blog/C++/003-vscode%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA/" target="_blank">
距离上次写博客已经过了两个月了,第一个月在钓鱼,第二个月在适应新公司。
新公司确实比之前的要好,但是没有想象中的那么好,总之,还是朝着微软努力吧。
最近也升级了电脑的主板,由于操作的原因,导致了需要重装系统,所以各种环境还得再搭一遍。以前是按照别人的博客搭建的,现在自己按照官方文档搞了一下,发现超级简单。
下载 vscodehttps://code.visualstudio.com/
安装c+
</a>
</p>
<div class="index-btm post-metas">
<div class="post-meta mr-3">
<i class="iconfont icon-date"></i>
<time datetime="2021-06-13 00:00" pubdate>
2021-06-13
</time>
</div>
<div class="post-meta mr-3">
<i class="iconfont icon-category"></i>
<a href="/categories/C/">C++</a>
</div>
</div>
</article>
</div>
<div class="row mx-auto index-card">
<div class="col-12 col-md-4 m-auto index-img">
<a href="/2021/04/05/blog_bak/Blog/Git/002-Git%E7%9A%84%E7%9B%B8%E5%AF%B9%E5%BC%95%E7%94%A8/" target="_blank">
<img src="/cover/5.jpg" srcset="/img/loading.gif" lazyload alt="002-Git的相对引用">
</a>
</div>
<article class="col-12 col-md-8 mx-auto index-info">
<h1 class="index-header">
<a href="/2021/04/05/blog_bak/Blog/Git/002-Git%E7%9A%84%E7%9B%B8%E5%AF%B9%E5%BC%95%E7%94%A8/" target="_blank">
002-Git的相对引用
</a>
</h1>
<p class="index-excerpt">
<a href="/2021/04/05/blog_bak/Blog/Git/002-Git%E7%9A%84%E7%9B%B8%E5%AF%B9%E5%BC%95%E7%94%A8/" target="_blank">
headHEAD 是一个对当前检出记录的符号引用 —— 也就是指向你正在其基础上进行工作的提交记录。
HEAD 总是指向当前分支上最近一次提交记录。大多数修改提交树的 Git 命令都是从改变 HEAD 的指向开始的。
HEAD 通常情况下是指向分支名的(如 bugFix)。
当我们执行如下命令后,会发生什么:
1234git checkout C1git checkout maingit com
</a>
</p>
<div class="index-btm post-metas">
<div class="post-meta mr-3">
<i class="iconfont icon-date"></i>
<time datetime="2021-04-05 00:00" pubdate>
2021-04-05
</time>
</div>
<div class="post-meta mr-3">
<i class="iconfont icon-category"></i>
<a href="/categories/Git/">Git</a>
</div>
</div>
</article>
</div>
<div class="row mx-auto index-card">
<div class="col-12 col-md-4 m-auto index-img">
<a href="/2021/04/05/blog_bak/Blog/Git/001-Git%E5%B8%B8%E7%94%A8%E6%8C%87%E4%BB%A4%E5%9B%BE%E8%A7%A3/" target="_blank">
<img src="/cover/5.jpg" srcset="/img/loading.gif" lazyload alt="001-Git常用指令图解">
</a>
</div>
<article class="col-12 col-md-8 mx-auto index-info">
<h1 class="index-header">
<a href="/2021/04/05/blog_bak/Blog/Git/001-Git%E5%B8%B8%E7%94%A8%E6%8C%87%E4%BB%A4%E5%9B%BE%E8%A7%A3/" target="_blank">
001-Git常用指令图解
</a>
</h1>
<p class="index-excerpt">
<a href="/2021/04/05/blog_bak/Blog/Git/001-Git%E5%B8%B8%E7%94%A8%E6%8C%87%E4%BB%A4%E5%9B%BE%E8%A7%A3/" target="_blank">
内容全部基于 Learn Git Branching。
这是个网页版 Git 小游戏,很有意思的,希望大家可以花半天时间通关。
还有一个叫做 oh-my-git 的游戏也挺有意思。
git commit下图展示了一个(小型)Git 代码库(本地的)。当前有两个提交记录 —— 初始提交 C0 和其后可能包含某些有用修改的提交 C1。
然后,我们做一个 git commit操作,添加一个新提交
</a>
</p>
<div class="index-btm post-metas">
<div class="post-meta mr-3">
<i class="iconfont icon-date"></i>
<time datetime="2021-04-05 00:00" pubdate>
2021-04-05
</time>
</div>
<div class="post-meta mr-3">
<i class="iconfont icon-category"></i>
<a href="/categories/Git/">Git</a>
</div>
</div>
</article>
</div>
<div class="row mx-auto index-card">
<div class="col-12 col-md-4 m-auto index-img">
<a href="/2021/03/13/blog_bak/Blog/Android-%E6%BA%90%E7%A0%81%E8%A7%A3%E6%9E%90/LeakCanary/0004-%E7%9C%9F%E6%AD%A3%E6%89%A7%E8%A1%8C%E7%9B%91%E6%B5%8B%E7%9A%84%E7%B1%BB/" target="_blank">
<img src="/cover/13.jpg" srcset="/img/loading.gif" lazyload alt="0004-真正执行监测的类">
</a>
</div>
<article class="col-12 col-md-8 mx-auto index-info">
<h1 class="index-header">
<a href="/2021/03/13/blog_bak/Blog/Android-%E6%BA%90%E7%A0%81%E8%A7%A3%E6%9E%90/LeakCanary/0004-%E7%9C%9F%E6%AD%A3%E6%89%A7%E8%A1%8C%E7%9B%91%E6%B5%8B%E7%9A%84%E7%B1%BB/" target="_blank">
0004-真正执行监测的类
</a>
</h1>
<p class="index-excerpt">
<a href="/2021/03/13/blog_bak/Blog/Android-%E6%BA%90%E7%A0%81%E8%A7%A3%E6%9E%90/LeakCanary/0004-%E7%9C%9F%E6%AD%A3%E6%89%A7%E8%A1%8C%E7%9B%91%E6%B5%8B%E7%9A%84%E7%B1%BB/" target="_blank">
上一篇我们分析了不少类,但是实际上它们做的工作主要是寻找监测点的工作,但是具体如何监测,都被委托给了 ReachabilityWatcher 这个接口。
这个接口只有一个实现了,就是 ObjectWatcher。
ObjectWatcher我们先看 expectWeaklyReachable 这个方法,毕竟,委托的时候,就是调用的这个方法。
leakcanary.ObjectWatcher#ex
</a>
</p>
<div class="index-btm post-metas">
<div class="post-meta mr-3">
<i class="iconfont icon-date"></i>
<time datetime="2021-03-13 00:00" pubdate>
2021-03-13
</time>
</div>
<div class="post-meta mr-3">
<i class="iconfont icon-category"></i>
<a href="/categories/LeakCanary/">LeakCanary</a>
</div>
<div class="post-meta">
<i class="iconfont icon-tags"></i>
<a href="/tags/Android%E6%BA%90%E7%A0%81%E8%A7%A3%E6%9E%90-LeakCanary/">Android源码解析-LeakCanary</a>
</div>
</div>
</article>
</div>
<div class="row mx-auto index-card">
<div class="col-12 col-md-4 m-auto index-img">
<a href="/2021/03/11/blog_bak/Blog/Android-%E6%BA%90%E7%A0%81%E8%A7%A3%E6%9E%90/LeakCanary/0002-%E8%87%AA%E5%8A%A8%E5%88%9D%E5%A7%8B%E5%8C%96/" target="_blank">
<img src="/cover/11.jpg" srcset="/img/loading.gif" lazyload alt="0002-自动初始化">
</a>
</div>
<article class="col-12 col-md-8 mx-auto index-info">
<h1 class="index-header">
<a href="/2021/03/11/blog_bak/Blog/Android-%E6%BA%90%E7%A0%81%E8%A7%A3%E6%9E%90/LeakCanary/0002-%E8%87%AA%E5%8A%A8%E5%88%9D%E5%A7%8B%E5%8C%96/" target="_blank">
0002-自动初始化
</a>
</h1>
<p class="index-excerpt">
<a href="/2021/03/11/blog_bak/Blog/Android-%E6%BA%90%E7%A0%81%E8%A7%A3%E6%9E%90/LeakCanary/0002-%E8%87%AA%E5%8A%A8%E5%88%9D%E5%A7%8B%E5%8C%96/" target="_blank">
源码版本 2.6
AS 版本 4.1.1
使用新版的使用就非常的简单了:
1234dependencies { // debugImplementation because LeakCanary should only run in debug builds. debugImplementation 'com.squareup.leakcanary:leakcanar
</a>
</p>
<div class="index-btm post-metas">
<div class="post-meta mr-3">
<i class="iconfont icon-date"></i>
<time datetime="2021-03-11 00:00" pubdate>
2021-03-11
</time>
</div>
<div class="post-meta mr-3">
<i class="iconfont icon-category"></i>
<a href="/categories/LeakCanary/">LeakCanary</a>
</div>
<div class="post-meta">
<i class="iconfont icon-tags"></i>
<a href="/tags/Android%E6%BA%90%E7%A0%81%E8%A7%A3%E6%9E%90-LeakCanary/">Android源码解析-LeakCanary</a>
</div>
</div>
</article>
</div>
<div class="row mx-auto index-card">
<div class="col-12 col-md-4 m-auto index-img">
<a href="/2021/03/11/blog_bak/Blog/Android-%E6%BA%90%E7%A0%81%E8%A7%A3%E6%9E%90/LeakCanary/0003-%E7%9B%91%E6%B5%8B%E9%A1%B5%E9%9D%A2%E4%B8%8EView%E6%98%AF%E5%90%A6%E6%B3%84%E9%9C%B2%E7%9A%84Watcher/" target="_blank">
<img src="/cover/11.jpg" srcset="/img/loading.gif" lazyload alt="0003-监测页面与View是否泄露的Watcher">
</a>
</div>
<article class="col-12 col-md-8 mx-auto index-info">
<h1 class="index-header">
<a href="/2021/03/11/blog_bak/Blog/Android-%E6%BA%90%E7%A0%81%E8%A7%A3%E6%9E%90/LeakCanary/0003-%E7%9B%91%E6%B5%8B%E9%A1%B5%E9%9D%A2%E4%B8%8EView%E6%98%AF%E5%90%A6%E6%B3%84%E9%9C%B2%E7%9A%84Watcher/" target="_blank">
0003-监测页面与View是否泄露的Watcher
</a>
</h1>
<p class="index-excerpt">
<a href="/2021/03/11/blog_bak/Blog/Android-%E6%BA%90%E7%A0%81%E8%A7%A3%E6%9E%90/LeakCanary/0003-%E7%9B%91%E6%B5%8B%E9%A1%B5%E9%9D%A2%E4%B8%8EView%E6%98%AF%E5%90%A6%E6%B3%84%E9%9C%B2%E7%9A%84Watcher/" target="_blank">
想要监测一个对象是否泄露,需要知道的是这个对象什么时候应该被销毁,然后再做相应的处理,所以第一个难点是如何找准这个销毁的时机。
下面我们具体分析源码,看它是如何做的。
所有的 Watcher 都在这个方法里面:
leakcanary.AppWatcher#appDefaultWatchers
1234567891011fun appDefaultWatchers( application
</a>
</p>
<div class="index-btm post-metas">
<div class="post-meta mr-3">
<i class="iconfont icon-date"></i>
<time datetime="2021-03-11 00:00" pubdate>
2021-03-11
</time>
</div>
<div class="post-meta mr-3">
<i class="iconfont icon-category"></i>
<a href="/categories/LeakCanary/">LeakCanary</a>
</div>
<div class="post-meta">
<i class="iconfont icon-tags"></i>
<a href="/tags/Android%E6%BA%90%E7%A0%81%E8%A7%A3%E6%9E%90-LeakCanary/">Android源码解析-LeakCanary</a>
</div>
</div>
</article>
</div>
<div class="row mx-auto index-card">
<div class="col-12 col-md-4 m-auto index-img">
<a href="/2021/03/06/blog_bak/Blog/%E6%8A%98%E8%85%BE/%E9%95%9C%E5%83%8F%E4%B8%8E%E4%BB%A3%E7%90%86%E9%97%AE%E9%A2%98/" target="_blank">
<img src="/cover/6.jpg" srcset="/img/loading.gif" lazyload alt="镜像与代理问题">
</a>
</div>
<article class="col-12 col-md-8 mx-auto index-info">
<h1 class="index-header">
<a href="/2021/03/06/blog_bak/Blog/%E6%8A%98%E8%85%BE/%E9%95%9C%E5%83%8F%E4%B8%8E%E4%BB%A3%E7%90%86%E9%97%AE%E9%A2%98/" target="_blank">
镜像与代理问题
</a>
</h1>
<p class="index-excerpt">
<a href="/2021/03/06/blog_bak/Blog/%E6%8A%98%E8%85%BE/%E9%95%9C%E5%83%8F%E4%B8%8E%E4%BB%A3%E7%90%86%E9%97%AE%E9%A2%98/" target="_blank">
Android Stuido 设置SDK镜像地址
打开设置界面,搜索 proxy
找到 HTTP Proxy 选项
在 Auto-detect proxy settings 里面填入镜像地址
Android Studio 设置本地代理(clash等)打开工程的 gradle.properties 文件:
12345678910111213systemProp.http.proxyHost=ww
</a>
</p>
<div class="index-btm post-metas">
<div class="post-meta mr-3">
<i class="iconfont icon-date"></i>
<time datetime="2021-03-06 00:00" pubdate>
2021-03-06
</time>
</div>
<div class="post-meta mr-3">
<i class="iconfont icon-category"></i>
<a href="/categories/%E6%8A%98%E8%85%BE/">折腾</a>
</div>
</div>
</article>
</div>
<div class="row mx-auto index-card">
<div class="col-12 col-md-4 m-auto index-img">
<a href="/2021/03/04/blog_bak/Blog/flutter/010-Provider%E7%9A%84%E7%90%86%E8%A7%A3/" target="_blank">
<img src="/cover/4.jpg" srcset="/img/loading.gif" lazyload alt="Provider的理解">
</a>
</div>
<article class="col-12 col-md-8 mx-auto index-info">
<h1 class="index-header">
<a href="/2021/03/04/blog_bak/Blog/flutter/010-Provider%E7%9A%84%E7%90%86%E8%A7%A3/" target="_blank">
Provider的理解
</a>
</h1>
<p class="index-excerpt">
<a href="/2021/03/04/blog_bak/Blog/flutter/010-Provider%E7%9A%84%E7%90%86%E8%A7%A3/" target="_blank">
Provider 是官方推荐的状态管理框架。那么状态又是什么东西?在 Flutter 中,万物都是 Widget,Widget 又分为两种:
StatelessWidget(无状态)
StatefulWidget (有状态)
12345有些widgets是有状态的, 有些是无状态的如果用户与widget交互,widget会发生变化,那么它就是有状态的.widget的状态(state)是一些可
</a>
</p>
<div class="index-btm post-metas">
<div class="post-meta mr-3">
<i class="iconfont icon-date"></i>
<time datetime="2021-03-04 00:00" pubdate>
2021-03-04
</time>
</div>
<div class="post-meta mr-3">
<i class="iconfont icon-category"></i>
<a href="/categories/Flutter/">Flutter</a>
</div>
</div>
</article>
</div>
<nav aria-label="navigation">
<span class="pagination" id="pagination">
<span class="page-number current">1</span><a class="page-number" href="/page/2/#board">2</a><a class="page-number" href="/page/3/#board">3</a><span class="space">…</span><a class="page-number" href="/page/24/#board">24</a><a class="extend next" rel="next" href="/page/2/#board"><i class="iconfont icon-arrowright"></i></a>
</span>
</nav>
</div>
</div>
</div>
</div>
</div>
<a id="scroll-top-button" href="#" role="button">
<i class="iconfont icon-arrowup" aria-hidden="true"></i>
</a>
<div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
<div class="modal-content">
<div class="modal-header text-center">
<h4 class="modal-title w-100 font-weight-bold">搜索</h4>
<button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body mx-3">
<div class="md-form mb-5">
<input type="text" id="local-search-input" class="form-control validate">
<label data-error="x" data-success="v"
for="local-search-input">关键词</label>
</div>
<div class="list-group" id="local-search-result"></div>
</div>
</div>
</div>
</div>
</main>
<footer class="text-center mt-5 py-3">
<div class="footer-content">
<a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a>
</div>
<div class="statistics">
<!-- LeanCloud 统计PV -->
<span id="leancloud-site-pv-container" style="display: none">
总访问量
<span id="leancloud-site-pv"></span>
次
</span>
<!-- LeanCloud 统计UV -->
<span id="leancloud-site-uv-container" style="display: none">
总访客数
<span id="leancloud-site-uv"></span>
人
</span>
</div>
</footer>
<!-- SCRIPTS -->
<script src="https://cdn.staticfile.org/nprogress/0.2.0/nprogress.min.js" ></script>
<link rel="stylesheet" href="https://cdn.staticfile.org/nprogress/0.2.0/nprogress.min.css" />
<script>
NProgress.configure({"showSpinner":false,"trickleSpeed":200})
NProgress.start()
window.addEventListener('load', function() {
NProgress.done();
})
</script>
<script src="https://cdn.staticfile.org/jquery/3.5.1/jquery.min.js" ></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/4.5.3/js/bootstrap.min.js" ></script>
<script src="/js/events.js" ></script>
<script src="/js/plugins.js" ></script>
<!-- Plugins -->
<script src="/js/img-lazyload.js" ></script>
<script defer src="https://cdn.staticfile.org/clipboard.js/2.0.6/clipboard.min.js" ></script>
<script src="/js/local-search.js" ></script>
<script defer src="/js/leancloud.js" ></script>
<script src="https://cdn.staticfile.org/typed.js/2.0.11/typed.min.js" ></script>
<script>
(function (window, document) {
var typing = Fluid.plugins.typing;
var title = document.getElementById('subtitle').title;
typing(title)
})(window, document);
</script>
<!-- 主题的启动项 保持在最底部 -->
<script src="/js/boot.js" ></script>
</body>
</html>