summaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/degesch.c b/degesch.c
index 6d120c2..d96567f 100644
--- a/degesch.c
+++ b/degesch.c
@@ -1904,6 +1904,8 @@ struct plugin
struct plugin_vtable
{
+ /// Collect garbage
+ void (*gc) (struct plugin *self);
/// Unregister and free the plugin including all relevant resources
void (*free) (struct plugin *self);
};
@@ -5382,6 +5384,9 @@ transport_tls_init_ctx (struct server *s, SSL_CTX *ssl_ctx, struct error **e)
#ifdef SSL_OP_NO_COMPRESSION
SSL_CTX_set_options (ssl_ctx, SSL_OP_NO_COMPRESSION);
#endif // SSL_OP_NO_COMPRESSION
+#ifdef LOMEM
+ SSL_CTX_set_mode (ssl_ctx, SSL_MODE_RELEASE_BUFFERS);
+#endif // LOMEM
struct error *error = NULL;
if (!transport_tls_init_ca (s, ssl_ctx, &error))
@@ -8438,6 +8443,13 @@ struct lua_plugin
};
static void
+lua_plugin_gc (struct plugin *self_)
+{
+ struct lua_plugin *self = (struct lua_plugin *) self_;
+ lua_gc (self->L, LUA_GCCOLLECT);
+}
+
+static void
lua_plugin_free (struct plugin *self_)
{
struct lua_plugin *self = (struct lua_plugin *) self_;
@@ -8446,6 +8458,7 @@ lua_plugin_free (struct plugin *self_)
struct plugin_vtable lua_plugin_vtable =
{
+ .gc = lua_plugin_gc,
.free = lua_plugin_free,
};
@@ -13821,7 +13834,14 @@ on_flush_timer (struct app_context *ctx)
"Log write failure detected for #s", buffer->name);
}
- // TODO: maybe also garbage collect all plugins?
+#ifdef LOMEM
+ // Lua should normally be reasonable and collect garbage when needed,
+ // though we can try to push it. This is a reasonable place.
+ LIST_FOR_EACH (struct plugin, iter, ctx->plugins)
+ if (iter->vtable->gc)
+ iter->vtable->gc (iter);
+#endif // LOMEM
+
rearm_flush_timer (ctx);
}