php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74215 Memory leaks with mailparse
Submitted: 2017-03-07 06:11 UTC Modified: 2020-09-14 15:36 UTC
Votes:2
Avg. Score:4.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: naoki-kawamukai at cybozu dot co dot jp Assigned: cmb (profile)
Status: Closed Package: mailparse (PECL)
PHP Version: 7.1.2 OS: Debian 8.6
Private report: No CVE-ID: None
 [2017-03-07 06:11 UTC] naoki-kawamukai at cybozu dot co dot jp
Description:
------------
When I run the test script with latest mailparse(master branch; bc51125921ae1287e3b4705bec1dfd8859d16213 ) and PHP 7.1.2(or PHP7.0.30),
memory is not freed.
When I run it with debug mode, any memory leak is not reported.

But with PHP 5.6.30, memory is freed.

Test script:
---------------
<?php

echo('Before: ' . memory_get_usage() . PHP_EOL);
for ($i = 0; $i < 10000; $i++) {
    if ($i % 1000 == 0)
        echo(' .. ' . memory_get_usage() . PHP_EOL);
    new MimeMessage('file', 'tests/testdata/m0001.txt');
}
echo('After: ' . memory_get_usage() . PHP_EOL);
gc_collect_cycles();
echo('After(gc_collect_cycles): ' . memory_get_usage() . PHP_EOL);

Expected result:
----------------
# This is a result of PHP 5.6.30 and mailparse 2.1.6

Before: 225304
 .. 225488
 .. 225552
 .. 225552
 .. 225552
 .. 225552
 .. 225552
 .. 225552
 .. 225552
 .. 225552
 .. 225552
After: 225552
After(gc_collect_cycles): 225552

Actual result:
--------------
# This is a result of PHP 7.1.2 and latest mailparse 

Before: 350416
 .. 350448
 .. 760368
 .. 1166512
 .. 1834800
 .. 1978800
 .. 3171400
 .. 3315400
 .. 3459400
 .. 3603400
 .. 5844552
After: 5988552
After(gc_collect_cycles): 5988552

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-03-07 06:14 UTC] naoki-kawamukai at cybozu dot co dot jp
'tests/testdata/m0001.txt' is https://github.com/php/pecl-mail-mailparse/blob/master/tests/testdata/m0001.txt
 [2020-09-14 15:36 UTC] cmb@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2020-09-14 15:55 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix #74215: Memory leaks with mailparse
On GitHub:  https://github.com/php/pecl-mail-mailparse/pull/11
Patch:      https://github.com/php/pecl-mail-mailparse/pull/11.patch
 [2020-09-15 10:57 UTC] remi@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=pecl/mail/mailparse.git;a=commit;h=afd52273855ef586ace85c8bc523d78fe178ce32
Log: Fix #74215: Memory leaks with mailparse
 [2020-09-15 10:57 UTC] remi@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC