Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
极客时间账号: 18689538156
感悟:对于此次作业,断断续续拖了一个多月才完成,原因是做的时候发现没头绪,然后工作又忙了一下,不忙的时候试了一下发现还是搞不定,看着群也没怎么讨论,提交的PR也没几个,又没动力去弄作业。后面听着大家们聊天啥的,遇到困难,走出舒适区才能有所成长,不然一直都是一年的经验被几年重复用。 于是乎花一大块两个晚上时间,看PR和参考Haha和Pref库,在各位PR的帮助下,完成了此次作业。
实现方法:1.App下用代码加载几张重复的image图片,并dump出hprof文件;
2.引入Haha库加载hprof文件(注意如果文件过大,一些低配手机或者模拟器会OOM,这里我没花时间找怎么裁剪hprof文件,采用的是加载重复的小图片,这样生成的hprof文件也小);
3.HahaHelper的方法,得引入 Leakcanary库才有,并且遇到调用 fieldValue 方法是 protected 方法,所以参考其他PR,把对应的源码Copy出来,然后来操作;
4.解析对比“app”和“default” 里面有没有重复的hashcode的图片,打印出引用链。
最后感谢之前同学的PR参考以及自己的不放弃,坚持走出舒适区才能有所成长!@@