Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sys1yagi/leak-checker
casual memory leak checker for Android.
https://github.com/sys1yagi/leak-checker
Last synced: 14 days ago
JSON representation
casual memory leak checker for Android.
- Host: GitHub
- URL: https://github.com/sys1yagi/leak-checker
- Owner: sys1yagi
- License: apache-2.0
- Created: 2014-04-09T03:29:54.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-04-09T11:33:11.000Z (over 10 years ago)
- Last Synced: 2024-04-14T14:51:51.026Z (7 months ago)
- Language: Java
- Size: 1.17 MB
- Stars: 6
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
leak-checker
============casual memory leak checker for Android.
## setup
build.gradle
```
apply plugin: 'android'repositories {
mavenCentral()
maven { url 'https://raw.github.com/sys1yagi/leak-checker/master/repository' }
}//...
dependencies {
compile 'com.sys1yagi:leak-checker:0.0.1'
}
```## modules
- LeakChecker
- Monitor whether an object is leaking.
- MomoryUsage
- Print the memory usage of application.
- ILogger
- Receive information from each module.
## MemoryUsage
```
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MemoryUsage.startPrintMemoryUsage();
}@Override
public void onDestroy() {
super.onDestroy();
MemoryUsage.stopPrintMemoryUsage();
}
```default output to Logcat.
## LeakChecker
register object.
```
LeakChecker.addLeakChecker(bitmap)
```dump the object of on-memory.
```
LeakChecker.dump()
```example. [see sample](https://github.com/sys1yagi/leak-checker/tree/master/sample)
## Custom Logger
ex : output TextView.
```
public class TextViewMonitorLogger implements ILogger {
private TextView target;public TextViewMonitorLogger(TextView target) {
this.target = target;
}@Override
public void print(String tag, String message) {
target.setText(message);
}
}
```set custom logger
```
LeakChecker.setLogger(logger);
MemoryUsage.setLogger(logger);
```ex : display the memory usage in TextView
```
TextViewMonitorLogger logger = new TextViewMonitorLogger(textView);
MemoryUsage.setLogger(logger);
```enjoy!