The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/4613
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === The GC has come a long way since we had to add those calls to avoid fd leaks when getting rid of references to the lxc struct. Signed-off-by: Stéphane Graber <[email protected]>
From 98e7bc084a5273c31892f26e15c6970acf99afc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <[email protected]> Date: Thu, 31 May 2018 16:53:05 -0400 Subject: [PATCH] Drop manual GC calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The GC has come a long way since we had to add those calls to avoid fd leaks when getting rid of references to the lxc struct. Signed-off-by: Stéphane Graber <[email protected]> --- lxd/daemon.go | 13 ------------- lxd/operations.go | 13 ------------- 2 files changed, 26 deletions(-) diff --git a/lxd/daemon.go b/lxd/daemon.go index a0342dcb4..d1a30fcfb 100644 --- a/lxd/daemon.go +++ b/lxd/daemon.go @@ -11,7 +11,6 @@ import ( "net/url" "os" "path/filepath" - "runtime" "strings" "sync" "syscall" @@ -318,18 +317,6 @@ func (d *Daemon) createCmd(restAPI *mux.Router, version string, c Command) { logger.Errorf("Failed writing error for error, giving up") } } - - /* - * When we create a new lxc.Container, it adds a finalizer (via - * SetFinalizer) that frees the struct. However, it sometimes - * takes the go GC a while to actually free the struct, - * presumably since it is a small amount of memory. - * Unfortunately, the struct also keeps the log fd open, so if - * we leave too many of these around, we end up running out of - * fds. So, let's explicitly do a GC to collect these at the - * end of each request. - */ - runtime.GC() }) } diff --git a/lxd/operations.go b/lxd/operations.go index 466e28896..849256ed2 100644 --- a/lxd/operations.go +++ b/lxd/operations.go @@ -3,7 +3,6 @@ package main import ( "fmt" "net/http" - "runtime" "strings" "sync" "time" @@ -100,18 +99,6 @@ func (op *operation) done() { if err != nil { logger.Warnf("Failed to delete operation %s: %s", op.id, err) } - - /* - * When we create a new lxc.Container, it adds a finalizer (via - * SetFinalizer) that frees the struct. However, it sometimes - * takes the go GC a while to actually free the struct, - * presumably since it is a small amount of memory. - * Unfortunately, the struct also keeps the log fd open, so if - * we leave too many of these around, we end up running out of - * fds. So, let's explicitly do a GC to collect these at the - * end of each request. - */ - runtime.GC() }) }
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
