[lxc-devel] [lxd/master] Drop manual GC calls
stgraber on Github
lxc-bot at linuxcontainers.org
Thu May 31 21:05:57 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 485 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180531/a7d5792a/attachment.bin>
-------------- next part --------------
From 98e7bc084a5273c31892f26e15c6970acf99afc4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
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 <stgraber at ubuntu.com>
---
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()
})
}
More information about the lxc-devel
mailing list