I am a big fan of chat secure, and recently I am writing a static code analysis tool to conduct performance analysis for Android apps. I found several violations of "resource leakage" patterns in chat secure's code. These violations could affect the performance of your app. Here is a representative one.
In info.guardianproject.otr.app.im.app.ChatView$DataAdapter$1, the method handleMessage() invokes "new MediaPlayer();" to create MediaPlayer. However, according to the suggestion of android developer, when done with the MediaPlayer, it is a good practice to call release(), to free the resources. If not released, too many MediaPlayer instances may result in an exception. Unfortunately, this principle is not correctly applied in this method.
So I am curious :) Looking forward to your response. Thanks.
Dear developers,
I am a big fan of chat secure, and recently I am writing a static code analysis tool to conduct performance analysis for Android apps. I found several violations of "resource leakage" patterns in chat secure's code. These violations could affect the performance of your app. Here is a representative one.
In info.guardianproject.otr.app.im.app.ChatView$DataAdapter$1, the method handleMessage() invokes "new MediaPlayer();" to create MediaPlayer. However, according to the suggestion of android developer, when done with the MediaPlayer, it is a good practice to call release(), to free the resources. If not released, too many MediaPlayer instances may result in an exception. Unfortunately, this principle is not correctly applied in this method.
So I am curious :) Looking forward to your response. Thanks.
References: resource leakage pattern: http://developer.android.com/reference/android/media/MediaPlayer.html