Uploaded image for project: 'Commons Email'
  1. Commons Email
  2. EMAIL-207

Don't waste memory in MimeMessageParser#createDataSource()

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5
    • 1.6.0
    • None

    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.

      @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();
      } 

      Below is the memory usage.

       

      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.

       

      Thanks.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ti6419 Jaeheon-Lee
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: