PHP 4.0 Bug #5176: Memory leak? Type handling?
| From: | slavapl at mailandnews dot com | Date: | Wed, 21 Jun 2000 17:51:04 +0000 |
| Subject: | PHP 4.0 Bug #5176: Memory leak? Type handling? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-22101@lists.php.net to get a copy of this message | ||
From: slavapl@mailandnews.com
Operating system: FreeBSD 3.2/Linux2.2.16
PHP version: 4.0 Latest CVS (21/06/2000)
PHP Bug Type: Scripting Engine problem
Bug description: Memory leak? Type handling?
while ( substr($linein = fgets($fs, 4096), 0, 1) != '.' ) {
$group_list[] = $linein;
}
This particular bit of code is used to read in a usenet message id listing, each item is 8
characters long (8 bytes??)
The memory usage grows to ridiculous length, for example 11k elements take up 43 megs on my linux
2.2.16 and freebsd 3.2.
I've been able to hack around the problem using substr like this:
while ( substr($linein = fgets($fs, 4096), 0, 1) != '.' ) {
$group_list[] = substr($linein, 0, strlen($linein));
}
this decreased the memory usage to about 4 megs, by a factor of ~10.