Dump the Android application heap if an out of memory crash occured - Hallo sahabat Google Android Developer Tutorial, Pada Artikel yang anda baca kali ini dengan judul Dump the Android application heap if an out of memory crash occured, kami telah mempersiapkan artikel ini dengan baik untuk anda baca dan ambil informasi didalamnya. mudah-mudahan isi postingan
Artikel android, yang kami tulis ini dapat anda pahami. baiklah, selamat membaca.
Judul : Dump the Android application heap if an out of memory crash occured
link : Dump the Android application heap if an out of memory crash occured
Or, to any running thread:
Anda sekarang membaca artikel Dump the Android application heap if an out of memory crash occured dengan alamat link https://googleandroiddevelopertutorial.blogspot.com/2016/01/dump-android-application-heap-if-out-of.html
Judul : Dump the Android application heap if an out of memory crash occured
link : Dump the Android application heap if an out of memory crash occured
Dump the Android application heap if an out of memory crash occured
Solution overview
The idea is to store the application heap if an out of memory error happens. The HPROF file can be then analyzed using Eclipse Memory Analyzer Tool that I will present later.
Step 1: Create a class that implements Thread.UncaughtExceptionHandler
The implemented method uncaughtException will check if the exception is out of memory and if it's the case, the HPROF file will be dumped in the device storage.Step 2: Set the uncaught exception handler the thread we want to create the heap dump
It's very sample, we can either set the uncaught exception handler to the main thread:Or, to any running thread:
Step 3: Create a memory leaked code to invoke an out of memory exception
For example, by doing:Step 4: Analyze the HPROF file to fix the memory leak
Eclipse Memory Analyzer tool can be used to analyze the dumped heap, I will present the method in a separate article.Source code
The Activity code is the following and the sample source code can be found on Github.Demikianlah Artikel Dump the Android application heap if an out of memory crash occured
Sekianlah artikel Dump the Android application heap if an out of memory crash occured kali ini, mudah-mudahan bisa memberi manfaat untuk anda semua. baiklah, sampai jumpa di postingan artikel lainnya.
Anda sekarang membaca artikel Dump the Android application heap if an out of memory crash occured dengan alamat link https://googleandroiddevelopertutorial.blogspot.com/2016/01/dump-android-application-heap-if-out-of.html
Dump the Android application heap if an out of memory crash occured
4/
5
Oleh
Unknown