Jaeheon-Lee created EMAIL-207:
---------------------------------
Summary: Memory is wasted on createDataSource() in
MimeMessageParser.
Key: EMAIL-207
URL: https://issues.apache.org/jira/browse/EMAIL-207
Project: Commons Email
Issue Type: Improvement
Affects Versions: 1.5
Reporter: Jaeheon-Lee
*Found*
Hello.
OOM occurred in the mail service developed using Apache-commons-email.
I debugged and found that the mail lookup function was wasting memory!
*Problem*
Below is a test for reproducing the problem.
{code:java}
@Test
void memoryTest() throws Exception {
FileInputStream is = new FileInputStream("/test/oom.eml");
Session session = Session.getInstance(System.getProperties());
MimeMessage mimeMessage = new MimeMessage(session, is);
MimeMessageParser parser = new MimeMessageParser(mimeMessage).parse();
} {code}
Below is the memory usage.
!https://user-images.githubusercontent.com/63458653/258811815-721ddcb7-b30b-4688-afc4-6f773c85b6a8.png|width=841,height=174!
I was thinking of using Attachments as a buffer for OutputStream when I really
need them.
However, it is becoming a problem by putting all bytes[] in memory.
!https://user-images.githubusercontent.com/63458653/258811728-67c7f208-fc4a-4954-823a-3a6904d21dd7.png|width=552,height=421!
!https://user-images.githubusercontent.com/63458653/258811747-8b144f5a-2b15-4c9a-a070-4d179e0b1d09.png|width=824,height=392!
Thanks.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)