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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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: Thu Mar 28 11:01:27 2024 UTC