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: 2017-03-07 06:14 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: naoki-kawamukai at cybozu dot co dot jp Assigned:
Status: Open Package: mailparse (PECL)
PHP Version: 7.1.2 OS: Debian 8.6
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: naoki-kawamukai at cybozu dot co dot jp
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC