Memory improvements

FossilOrigin-Name: 74d721f05bd0cb5fd53a5fff34258113afc9087f2083688f733bc3fe5b32e323
This commit is contained in:
nekobit 2022-08-24 17:12:41 +00:00
parent 1b80b589b7
commit bebc9eb58b
3 changed files with 11 additions and 9 deletions

View File

@ -70,16 +70,16 @@ void render_base_page(struct base_page* page, FCGX_Request* req, struct session*
PERL_STACK_INIT;
if (page->session)
mXPUSHs(newRV_inc((SV*)page->session));
mXPUSHs(newRV_noinc((SV*)page->session));
else
mXPUSHs(newRV_inc((SV*)perlify_session(ssn)));
XPUSHs(newRV_inc((SV*)template_files));
mXPUSHs(newRV_noinc((SV*)perlify_session(ssn)));
XPUSHs(newRV_noinc((SV*)template_files));
XPUSHs(sv_2mortal(newSVpv(page->content, 0)));
if (notifs && notifs_len)
{
AV* notifs_av = perlify_notifications(notifs, notifs_len);
XPUSHs(sv_2mortal(newRV_inc((SV*)notifs_av)));
mXPUSHs(newRV_inc((SV*)notifs_av));
}
else XPUSHs(&PL_sv_undef);

View File

@ -55,9 +55,10 @@ static void xs_init (pTHX);
EXTERN_C void boot_DynaLoader (pTHX_ CV* cv);
#ifdef DEBUG
static int quit = 0;
static void exit_treebird(PATH_ARGS)
{
exit(0);
quit = 1;
}
#endif
@ -213,7 +214,7 @@ static void* threaded_fcgi_start(void* arg)
#else
void cgi_start(mastodont_t* api)
{
while (FCGI_Accept() >= 0)
while (FCGI_Accept() >= 0 && quit == 0)
{
application(api, NULL);
}

View File

@ -111,11 +111,11 @@ void content_notifications_compact(PATH_ARGS)
PERL_STACK_INIT;
HV* session_hv = perlify_session(ssn);
XPUSHs(newRV_noinc((SV*)session_hv));
mXPUSHs(newRV_noinc((SV*)session_hv));
XPUSHs(newRV_noinc((SV*)template_files));
if (notifs)
XPUSHs(newRV_noinc((SV*)perlify_notifications(notifs, notifs_len)));
mXPUSHs(newRV_noinc((SV*)perlify_notifications(notifs, notifs_len)));
PERL_STACK_SCALAR_CALL("notifications::embed_notifications");
page = PERL_GET_STACK_EXIT;
@ -124,6 +124,7 @@ void content_notifications_compact(PATH_ARGS)
mastodont_storage_cleanup(&storage);
mstdnt_cleanup_notifications(notifs, notifs_len);
Safefree(page);
}
void content_notifications_clear(PATH_ARGS)