Skip to content

Commit 890f359

Browse files
xcasparMandssS
authored andcommitted
Fix memory overflow experimental scene problem
Signed-off-by: xcaspar <changjun.xcj@alibaba-inc.com>
1 parent 07c5107 commit 890f359

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ GO_FLAGS=-ldflags="-s -w"
1010
UNAME := $(shell uname)
1111

1212
ifeq ($(BLADE_VERSION), )
13-
BLADE_VERSION=1.4.0
13+
BLADE_VERSION=1.5.0
1414
endif
1515

1616
BUILD_TARGET=target

exec/bin/burnmem/burnmem.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ import (
4343
const PageCounterMax uint64 = 9223372036854770000
4444

4545
const (
46-
processOOMScoreAdj = "/proc/%s/oom_score_adj"
47-
oomMinScore = "-1000"
46+
//processOOMScoreAdj = "/proc/%s/oom_score_adj"
47+
//oomMinScore = "-1000"
48+
processOOMAdj = "/proc/%s/oom_adj"
49+
oomMinAdj = "-17"
4850
)
4951

5052
// 128K
@@ -211,12 +213,12 @@ func runBurnMem(ctx context.Context, memPercent, memReserve, memRate int, burnMe
211213
// adjust process oom_score_adj to avoid being killed
212214
if avoidBeingKilled {
213215
for _, pid := range pids {
214-
scoreAdjFile := fmt.Sprintf(processOOMScoreAdj, pid)
216+
scoreAdjFile := fmt.Sprintf(processOOMAdj, pid)
215217
if _, err := os.Stat(scoreAdjFile); os.IsNotExist(err) {
216218
continue
217219
}
218220

219-
if err := ioutil.WriteFile(scoreAdjFile, []byte(oomMinScore), 0644); err != nil {
221+
if err := ioutil.WriteFile(scoreAdjFile, []byte(oomMinAdj), 0644); err != nil {
220222
stopBurnMemFunc()
221223
bin.PrintErrAndExit(fmt.Sprintf("run burn memory by %s mode failed, cannot edit the process oom_score_adj",
222224
burnMemMode))

0 commit comments

Comments
 (0)