Skip to content

Commit 637898e

Browse files
committed
intra/tun2socks: process memlimit if non-negative
1 parent c881633 commit 637898e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

intra/tun2socks.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,9 @@ func LogLevel(gologLevel, consolelogLevel, callerDepth int32) {
246246
// setting maximum memory limit, if limit > 0.
247247
// github.com/golang/proposal/blob/master/design/48409-soft-memory-limit.md
248248
func LowMem(limitBytes int64) {
249-
limitBytes = max(limitBytes, minMemLimit)
249+
if limitBytes > 0 {
250+
limitBytes = max(limitBytes, minMemLimit)
251+
}
250252
prevLimit := debug.SetMemoryLimit(limitBytes)
251253
go debug.FreeOSMemory()
252254
log.I("tun: lowmem; limits => new: %d, prev: %d", limitBytes, prevLimit)

0 commit comments

Comments
 (0)