PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Networking » Net_NNTP » Bug #7149

memory leak

Details

Submitted2006-03-18 09:14 UTC
Fromstruchkov at gmail dot com
StatusBogus
PackageNet_NNTP
PHP Version5.1.2
OSLinux
Roadmaps(Not assigned)

Comments

[2006-03-18 09:14 UTC] struchkov at gmail dot com

Description:
------------
In my program I have error for 'memory limit exceeding' (In my php.ini I have memory_limit = 1024M). I write some test (see below) for server 'freetext.usenetserver.com' and one of group 'comp.binaries.apple2'
The information of this group is
Array
(
[group] => comp.binaries.apple2
[first] => 605209
[last] => 628428
[count] => 4
)

But I run iteration from first to last for my test. After each iteration memory size of process is increased for 10-20 KB.
From iteration-605209 (message-id) to iteration-605373 memory size is about 9 MB and virtual is about 28 MB. This indexes increase during iteration process.

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

require_once 'Net/NNTP/Client.php';

$server=&new Net_NNTP_Client();
$server->connect('freetext.usenetserver.com');

$group=$server->selectGroup('comp.binaries.apple2');

for($v=$group['first'];$v<=$group['last'];++$v)
{
$header=$server->getHeader($v);
if (PEAR::isError($header))
{
unset($header);
continue;
}
$body=$server->getBody($v,true);
if (PEAR::isError($body))
{
unset($body);
break;
}
}

$server->quit();

?>

[2006-03-20 10:14 UTC] heino at php dot net

I believe you have run into a queerness of PEAR's error handling - not a Net_NNTP bug.

Could you please try to execute the following code:

<?php

require_once('PEAR.php');

set_time_limit(0);

for ($i = 0; ; $i++) {
if (PEAR::isError(PEAR::raiseError('error'))) {
echo "Memory usage: " . memory_get_usage() . "\r\n";
}
}

?>

This should show the same leak, only not involving Net_NNTP.

In bug #6788 (http://pear.php.net/bugs/bug.php?id=6788) this leak is said to be a PHP related, and therefore outside the PEAR domain...

[2006-03-20 10:21 UTC] heino at php dot net

Please try using ->selectArticle() and ->selectNextArticle() instead. That way your script will only try to fetch articles that actually exist, and you don't end up wasting a lot of memory on PEAR errors...

I believe you have run into a queerness of PEAR's error handling, not a Net_NNTP bug - but honestly I'm not sure.

Could you please try to execute the following code:

<?php

require_once('PEAR.php');

set_time_limit(0);

for ($i = 0; ; $i++) {
if (PEAR::isError(PEAR::raiseError('error'))) {
echo "Memory usage: " . memory_get_usage() . "\r\n";
}
}

?>

This should show the same leak, only not involving Net_NNTP.

In bug #6788 (http://pear.php.net/bugs/bug.php?id=6788) this leak is said to be a PHP related, and therefore outside the PEAR domain.

[2006-03-20 20:29 UTC] struchkov at gmail dot com

You are right.
It's not Net_NNTP bug.
Sorry! Thanks!
What do you this about this bug?
When will php-team fix this?

[2006-06-17 22:07 UTC] heino at php dot net

...