mikel / mail

A Really Ruby Mail Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Excessive memory usage with attachments

dup2 opened this issue · comments

Hi all

When using the library to parse a existing message with messsage = Mail.read("test.eml") and then accessing the parts or attachments objects like mesage.parts.size or message.attachments.size we see excessive memory usage.

It seems like the attachments are being held fully in memory - the memory usage is very high.
For example with a message having a single attachment, originally 110 MB in size, base64-encoded in the message and thus the total size of the message coming up to 150 MB we see a overhead of memory usage of about factor two - the simple example above uses about 380 MB of memory.

Is there any option to parse a message without loading everything into memory upfront? Like in a streaming fashion?