Skip to content

Commit

Permalink
Merge pull request #70 from KwaiAppTeam/dev
Browse files Browse the repository at this point in the history
Release v1.1.0
  • Loading branch information
AndroidInternal authored Mar 30, 2021
2 parents 7c5e039 + 6e54db1 commit 49cb658
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 30 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,15 @@ Enhancement
- Add custom root dir validity check.

Bug fix
- StripHprofHeapDumper bugfix.
- StripHprofHeapDumper bugfix.

# v1.1.0
Enhancement
- Add heap max ratio and force trigger.
- Add support for x86.

Bug fix
- Hardcode cacheDir path on unpredictable case.
- Add try-catch in abnormal start, delete abnormal json file.


4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Try to run the koom-demo project first, and have a general understanding of the

```gradle
dependencies {
implementation 'com.kwai.koom:java-oom:1.0.7'
implementation 'com.kwai.koom:java-oom:1.1.0'
}
```

Expand Down Expand Up @@ -117,4 +117,4 @@ If you are interested in contributing, check out the [CONTRIBUTING.md](./CONTRIB
## Feedback
Welcome report [issues](https://github.com/KwaiAppTeam/KOOM/issues) or contact us in WeChat group.

<img src=./doc/images/wechat8.png/>
<img src=./doc/images/wechat.jpg/>
4 changes: 2 additions & 2 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ KOOM(Kwai OOM, Kill OOM)是快手性能优化团队在处理移动端OOM问题

```gradle
dependencies {
implementation 'com.kwai.koom:java-oom:1.0.7'
implementation 'com.kwai.koom:java-oom:1.1.0'
}
```

Expand Down Expand Up @@ -118,4 +118,4 @@ KOOM 以 Apache-2.0 证书开源,详情参见 [LICENSE](./LICENSE)。
**项目核心成员**<br>
[alhah(薛秋实)](https://github.com/alhah) <br>[AndroidInternal(李锐)](https://github.com/AndroidInternal)<br>
**微信讨论群**
<img src=./doc/images/wechat8.png/>。
<img src=./doc/images/wechat.jpg/>。
Binary file modified doc/images/wechat.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed doc/images/wechat8.png
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static KOOMEnableChecker get() {
*/
public boolean isVersionPermit() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
&& Build.VERSION.SDK_INT <= Build.VERSION_CODES.R;
&& Build.VERSION.SDK_INT < Build.VERSION_CODES.R;
}

/**
Expand Down
48 changes: 26 additions & 22 deletions java-oom/src/main/java/com/kwai/koom/javaoom/KOOMInternal.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,29 +89,33 @@ private void startInKOOMThread() {
private boolean started;

private void startInternal() {
if (started) {
KLog.i(TAG, "already started!");
return;
}
started = true;

heapDumpTrigger.setHeapDumpListener(this);
heapAnalysisTrigger.setHeapAnalysisListener(this);

if (KOOMEnableChecker.doCheck() != KOOMEnableChecker.Result.NORMAL) {
KLog.e(TAG, "koom start failed, check result: " + KOOMEnableChecker.doCheck());
return;
try {
if (started) {
KLog.i(TAG, "already started!");
return;
}
started = true;

heapDumpTrigger.setHeapDumpListener(this);
heapAnalysisTrigger.setHeapAnalysisListener(this);

if (KOOMEnableChecker.doCheck() != KOOMEnableChecker.Result.NORMAL) {
KLog.e(TAG, "koom start failed, check result: " + KOOMEnableChecker.doCheck());
return;
}

ReanalysisChecker reanalysisChecker = new ReanalysisChecker();
if (reanalysisChecker.detectReanalysisFile() != null) {
KLog.i(TAG, "detected reanalysis file");
heapAnalysisTrigger
.trigger(TriggerReason.analysisReason(TriggerReason.AnalysisReason.REANALYSIS));
return;
}

heapDumpTrigger.startTrack();
} catch (Exception e) {
e.printStackTrace();
}

ReanalysisChecker reanalysisChecker = new ReanalysisChecker();
if (reanalysisChecker.detectReanalysisFile() != null) {
KLog.i(TAG, "detected reanalysis file");
heapAnalysisTrigger
.trigger(TriggerReason.analysisReason(TriggerReason.AnalysisReason.REANALYSIS));
return;
}

heapDumpTrigger.startTrack();
}

public void stop() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ private HeapReport loadFile(File file) {
}
HeapReport heapReport = gson.fromJson(str, HeapReport.class);
return heapReport == null ? new HeapReport() : heapReport;
} catch (IOException e) {
//e.printStackTrace();
} catch (Exception e) {
file.delete();
} finally {
KUtils.closeQuietly(fin);
}
Expand Down

0 comments on commit 49cb658

Please sign in to comment.