[ 
https://issues.apache.org/jira/browse/EMAIL-207?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jaeheon-Lee updated EMAIL-207:
------------------------------
    Description: 
*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=715,height=148!

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=553,height=263!

 

Thanks.

  was:
*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=715,height=148!

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=553,height=263!

 

Thanks.


> 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
>            Priority: Major
>
> *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=715,height=148!
> 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=553,height=263!
>  
> Thanks.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to