Init Repo

This commit is contained in:
root
2019-09-06 23:53:10 +08:00
commit f0ef89dfbb
7905 changed files with 914138 additions and 0 deletions

View File

@ -0,0 +1,44 @@
--TEST--
swoole_memory_pool: fixed pool free [01]
--SKIPIF--
<?php require __DIR__ . '/../include/skipif.inc'; ?>
--INI--
assert.active=1
assert.warning=1
assert.bail=0
assert.quiet_eval=0
--FILE--
<?php
require_once __DIR__ . '/../include/bootstrap.php';
use Swoole\Memory\Pool;
$pool = new Pool(128 * 1024, Pool::TYPE_FIXED, 1024);
$slices = array();
for ($i = 0; $i < 125; $i++)
{
/**
* @var $p1 Swoole\Memory\Pool\Slice
*/
$p1 = $pool->alloc();
if ($p1 == false)
{
echo "index=$i\n";
break;
}
$p1->write("hello world-" . $i);
$slices[] = $p1;
}
$p1 = $pool->alloc();
assert($p1 == false);
//free lasest
unset($slices[count($slices) - 1]);
$p1 = $pool->alloc();
assert($p1 != false);
?>
--EXPECT--