jodd-mail
jodd-mail copied to clipboard
Optimize usage of FileDataSource with AttachmentStorage
Hi @igr,
i was optimizing the memory usage of my application and checking where humongous objects were allocated when processing emails with large attachments.
I was already using a streamed MimeMessage as input and also had configured an attachmentStorage folder. But for each attachment there was still a large byte array beeing allocated. Passing an inputStream to the .content method would always create a byte array.
So i have streamlined the usage of FileDataSource in this MR to have a minimal memory footprint.
Would be great if you could check my changes.
Best Regards ganomi