php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80086 Memory leak in mailparse_msg_create/mailparse_msg_free
Submitted: 2020-09-10 22:00 UTC Modified: 2020-09-14 15:35 UTC
From: zsogolow at zixcorp dot com Assigned: cmb (profile)
Status: Duplicate Package: mailparse (PECL)
PHP Version: 7.3.22 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: zsogolow at zixcorp dot com
New email:
PHP Version: OS:

 

 [2020-09-10 22:00 UTC] zsogolow at zixcorp dot com
Description:
------------
When looping over and parsing multiple emails, there appears to be a memory leak. Memory is not being freed when calling mailparse_msg_free after parsing. In the test script you will notice the memory usage steadily climbing.

Test script:
---------------
$i = 0;
while ($i++ < 100000) {
    $mail = mailparse_msg_create();
    mailparse_msg_parse($mail, file_get_contents("download.eml"));
    $struct = mailparse_msg_get_structure($mail);
    mailparse_msg_free($mail);

    echo "Memory Consumption is ";
    echo round(memory_get_usage() / 1048576, 2) . '' . ' MB' . PHP_EOL;
}

Expected result:
----------------
Memory to be freed

Actual result:
--------------
Memory usage continues to climb

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-09-14 15:35 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2020-09-14 15:35 UTC] cmb@php.net
Duplicate of bug #74215.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 09:01:31 2024 UTC