Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
Android: increase garbage collection frequency (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
alalamav authored Aug 7, 2019
1 parent 2428801 commit 1d8e9b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions android/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,18 @@ import (
"errors"
"log"
"os"
"runtime/debug"

"github.com/Jigsaw-Code/outline-go-tun2socks/tunnel"
)

const vpnMtu = 1500

func init() {
// Conserve memory by increasing garbage collection frequency.
debug.SetGCPercent(10)
}

func makeTunFile(fd int) (*os.File, error) {
if fd < 0 {
return nil, errors.New("Must provide a valid TUN file descriptor")
Expand Down
2 changes: 1 addition & 1 deletion tunnel/outline.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (t *outlinetunnel) SetUDPEnabled(isUDPEnabled bool) {
return
}
t.isUDPEnabled = isUDPEnabled
t.lwipStack.Close() // Close exisiting connections to avoid using the previous handlers.
t.lwipStack.Close() // Close existing connections to avoid using the previous handlers.
t.registerConnectionHandlers()
}

Expand Down

0 comments on commit 1d8e9b8

Please sign in to comment.