Android leak canarytool
https://corner.squareup.com/2015/05/leak-canary.html
How to check memory
adb shell dumpsysmeminfo com.microsoft.cortana -d
https://developer.android.com/studio/profile/investigate-ram.html#ViewingAllocations
http://blog.csdn.net/luoshengyang/article/details/6664554ashmem (android anonymous shared memory)
https://www.quora.com/What-is-the-difference-between-dirty-and-clean-memory(dirty clean memory)
http://stackoverflow.com/questions/10569077/android-do-i-have-a-memory-leak#comment13687443_10569077(allocateDirect)
PSS total >(private dirty + clean)
(both pss total andprivate dirty clean contains Zygnote allocation)
Android studiomemory analysis tool
https://developer.android.com/studio/profile/am-memory.html#forcing
https://developer.android.com/studio/profile/am-hprof.html
https://developer.android.com/studio/profile/am-allocation.html
Common possibleleaks http://android-developers.blogspot.jp/2009/01/avoiding-memory-leaks.html
http://www.androiddesignpatterns.com/2013/01/inner-class-handler-memory-leak.html
Weak referenceexample
http://www.androiddesignpatterns.com/2013/01/inner-class-handler-memory-leak.html
http://stackoverflow.com/questions/3243215/how-to-use-weakreference-in-java-and-android-development
common memoryleaks
http://blog.csdn.net/guolin_blog/article/details/42238627
http://blog.csdn.net/a396901990/article/details/38904543
ByteBuffer.allocate()vs. ByteBuffer.allocateDirect()
http://stackoverflow.com/questions/5670862/bytebuffer-allocate-vs-bytebuffer-allocatedirect
nondirect bufferallocate by jvm, store in jvm heap, may not continuously, gc will remove theallocate
direct bufferallocated by calling through to native, operating system-specific code,bypassing the standard JVM heap ,
intented forchannels and native I/O routines, The memory-storage areas of direct buffersare not subject to garbage collection because they are outside the standard JVMheap.
if native code readnondirect buffer, it will create a temp direct buffer and copy nondirect todirect, after use release
But nondirect hasits optimization like cache the temp direct buffer for future use.
Don't hold thereference to an object outside its lifecycle
create view withactivity(this) is dangerous
static drawable isdangerous
non static innerclass is dangerous