Hello,

I use TMimeMess for decoding incoming e-mails of my SMTP server based
on Synapse.

I discovered that for decoding 50MB MIME message (simple text with
attachments), TMimeMess used 600-800MB of memory.

Decoding code here:

  FMimeMsg.Header.DecodeHeaders(FMimeMsg.MessagePart.Lines);
  FMimeMsg.MessagePart.DecomposeParts;
  ExtractPartsFromMess(FMimeMsg.MessagePart);
...
procedure ExtractPartsFromMess(AMimePart: TMimePart);
var i: integer;
begin
  if AMimePart.GetSubPartCount = 0 then
    Begin
      if (AMimePart.PrimaryCode = MP_TEXT) then
        Begin
          AMimePart.TargetCharset := UTF_8;
          AMimePart.DecodePart;
          FBody.Add(string(ReadStrFromStream(AMimePart.DecodedLines,
AMimePart.DecodedLines.Size)));
        end
      else if (AMimePart.PrimaryCode = MP_BINARY) then
        Begin
          if AMimePart.FileName <> '' then
            Begin
              AMimePart.DecodePart;
              AMimePart.DecodedLines.SaveToFile(FPathToIncomingFolder
+ AMimePart.FileName);
            end;
        end;
    end
  else
    Begin
      for i:=0 to AMimePart.GetSubPartCount-1 do
        Begin
          ExtractBodyFromMess(AMimePart.GetSubPart(i));
        end;
    end;
end;


Is there is a way to decrease RAM usage?

Thanks a lot.

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to