Problems with internal resource counter
| From: | pierre dot heim at mindlab dot de | Date: | Fri, 20 Mar 2009 13:02:22 +0000 |
| Subject: | Problems with internal resource counter | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-6238@lists.php.net to get a copy of this message | ||
Hi listeners,
I have great problems with the internal resource counter of PHP. My module
deals hardly with resources (6 different types) and is used in a PHP
server script. After two weeks running PHP says:
"netmind_click_get_pair(): -2147483648 is not a valid netmind_click
resource in <file>". Then this Warning comes on every function where a
resource should be created. I have recognized that the counter used as
identifier for the resources always steps even if the resources were
destroed before allocating a new one. Is there a solution for this issue?
This small script shows the problem of the growing counter:
<?php
for( $i = 0; $i < 1000000; $i++ )
{
for( $j = 0; $j < 1000000; $j++ )
{
$nFile = fopen( "resourcetest.txt", "w" );
var_dump( $nFile );
fwrite( $nFile, time() );
fclose( $nFile );
} /* for() */
} /* for() */
?>
Greetings, Pierre
Pierre