php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73493 imap_fetchbody() [still] leaks memory
Submitted: 2016-11-11 04:55 UTC Modified: 2017-01-25 09:49 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:1 (33.3%)
From: leeoniya at gmail dot com Assigned: mike (profile)
Status: Not a bug Package: IMAP related
PHP Version: 7.0Git-2016-11-11 (snap) OS: Win10 x64
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: leeoniya at gmail dot com
New email:
PHP Version: OS:

 

 [2016-11-11 04:55 UTC] leeoniya at gmail dot com
Description:
------------
It looks like this was an issue in the past that was resolved [1], but it looks like this is still a problem. If you run attached code on a mailbox of a few hundred messages, you can see the mem grow continuously. Using `imap_savebody()` also leaks.

[1] https://bugs.php.net/bug.php?id=47940

Test script:
---------------
$imap = imap_open(IMAP_PATH, IMAP_USER, IMAP_PASS);
$uids = imap_sort($imap, SORTARRIVAL, 1, SE_UID | SE_NOPREFETCH);
$len = count($uids);

for ($i = 0; $i < $len; $i++)
  $raw = imap_fetchbody($imap, $uids[$i], "", FT_UID | FT_PEEK);


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-23 20:43 UTC] mike@php.net
-Assigned To: +Assigned To: mike
 [2017-01-25 09:49 UTC] mike@php.net
-Status: Assigned +Status: Not a bug
 [2017-01-25 09:49 UTC] mike@php.net
These are no "leaks" per se. 

The c-client library performs a lot of caching, if you want to clean the caches, use imap_gc() <http://php.net/imap_gc>.

See the diagrams at http://imgur.com/a/RRYXg for a comparison of a session with and without calling imap_gc(IMAP_GC_TEXTS) every now and then.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 01 11:03:37 2021 UTC