aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2017-07-29 17:12:32 +0200
committerJakob Unterwurzacher2017-07-29 17:17:12 +0200
commit86253b75670172fda6b481848cd63ca5685f112d (patch)
treef6f9d6259bb809d566ff205783091e3640eda22f
parentd12aa577156101a1c6a05765de751f0a54b58aa8 (diff)
main: doMount: call FreeOSMemory() before jumping into server loop
scrypt (used during masterkey decryption) allocates a lot of memory. Go only returns memory to the OS after 5 minutes, which looks like a waste. Call FreeOSMemory() to return it immediately. Looking a fresh mount: before: VmRSS: 73556 kB after: VmRSS: 8568 kB
-rw-r--r--mount.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/mount.go b/mount.go
index b8a7f72..7405ff3 100644
--- a/mount.go
+++ b/mount.go
@@ -10,6 +10,7 @@ import (
"path"
"path/filepath"
"runtime"
+ "runtime/debug"
"strings"
"syscall"
"time"
@@ -139,6 +140,9 @@ func doMount(args *argContainer) int {
// This prevents a dangling "Transport endpoint is not connected"
// mountpoint if the user hits CTRL-C.
handleSigint(srv, args.mountpoint)
+ // Return memory that was allocated for scrypt (64M by default!) and other
+ // stuff that is no longer needed to the OS
+ debug.FreeOSMemory()
// Jump into server loop. Returns when it gets an umount request from the kernel.
srv.Serve()
return 0