symfony: Memory Leak in Symfony Mailer when sending many attachments of >5MB

Symfony version(s) affected

5.4.22

Description

Hi , I have encountered an issue where attaching several files each of size 5MB , sends Out Of Memory exception Uncaught PHP Exception Symfony\Component\ErrorHandler\Error\OutOfMemoryError: "Error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 23079128 bytes)" at vendor/symfony/mime/RawMessage.php line 53 {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\OutOfMemoryError(code: 0): Error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 23079128 bytes) at vendor/symfony/mime/RawMessage.php:53)"} [

Is that a known issue. or am I missing something ?

I have already tried using attachPart, attach , but it produces the same results.

How to reproduce

Attach numerous Files from form to be sent in email each of size 5MB .

Possible Solution

No response

Additional Context

No response

About this issue

  • Original URL
  • State: open
  • Created 9 months ago
  • Comments: 16 (7 by maintainers)

Commits related to this issue

Most upvoted comments

While trying to understand why I wrote the code, I realized we should never change the internal representation. So, #51872 looks like a slightly better fix.