Well ok, it's not that much over the ~130Mo the usual library stack, but maybe we should replace the use with a require to load in only when needed?
Created attachment 121275 [details] [review] Bug 28416: Delay load of Email::Sender::Transport::SMTP As it's taking 10M of RAM
Can be tested with use Memory::Usage; my $mu = Memory::Usage->new(); $mu->record('Loading'); require Koha::Libraries; $mu->record('module loaded'); print $mu->report(); I don't think overall it's a good idea to use require, but maybe it's worth here?
This one is probably especially good to do, since it looks like transport() is often called within a try/catch block anyway.
(In reply to David Cook from comment #3) > This one is probably especially good to do, since it looks like transport() > is often called within a try/catch block anyway. I agree with this assertion. I'd add that we probably don't want this lib loaded on user facing places, as we are leaning towards using the message_queue more often than we do now.
So, signoff?
Created attachment 132028 [details] [review] Bug 28416: Delay load of Email::Sender::Transport::SMTP As it's taking 10M of RAM Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(In reply to Jonathan Druart from comment #2) > Can be tested with > > use Memory::Usage; > my $mu = Memory::Usage->new(); > $mu->record('Loading'); > require Koha::Libraries; > $mu->record('module loaded'); > print $mu->report(); > > I don't think overall it's a good idea to use require, but maybe it's worth > here? I tried moving the 'require' to the Koha::Library namespace. As we will probably load the Koha::SMTP::Server object only when we want the transport anyway. But it didn't help :-D So signing this patch as it is correct passes the QA tests and does the job. For testers: $ apt install libmemory-usage-perl
E: Unable to locate package libmemory-usage-perl
(In reply to Marcel de Rooy from comment #8) > E: Unable to locate package libmemory-usage-perl Resolved
Created attachment 132219 [details] [review] Bug 28416: Delay load of Email::Sender::Transport::SMTP As it's taking 10M of RAM Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(In reply to Jonathan Druart from comment #2) > I don't think overall it's a good idea to use require, but maybe it's worth > here? Dangerous precedent created ;)
Pushed to master for 22.05, thanks to everybody involved [U+1F984]