degesch: add a hidden LOMEM compile option
This commit is contained in:
parent
383f6af344
commit
98e95de90e
22
degesch.c
22
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))
|
||||
|
@ -8437,6 +8442,13 @@ struct lua_plugin
|
|||
struct lua_schema_item *schemas; ///< Registered schema items
|
||||
};
|
||||
|
||||
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_)
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue