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
This commit is contained in:
Jakob Unterwurzacher 2017-07-29 17:12:32 +02:00
parent d12aa57715
commit 86253b7567
1 changed files with 4 additions and 0 deletions

View File

@ -10,6 +10,7 @@ import (
@ -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
// Jump into server loop. Returns when it gets an umount request from the kernel.
return 0