pecl-ev / tests / 12_watcher_leak.phpt


ini_set('memory_limit', '5M');

$i = 0;
$startedAt = microtime(TRUE);
$callback = function() use (&$i, $startedAt) {
    if (!(++$i % 2500)) {
        echo vsprintf("%d\t%d\t%d\t%.4f\t%d\n", $last = [
            "job" => $i,
            "mem" => memory_get_usage(),
            "real" => memory_get_usage(true),
            "runtime" => $runtime = (microtime(true) - $startedAt),
            "jps" => ceil($i / $runtime)

$n = 0;
while (++$n < 10000) {
    //$timer = EvTimer::createStopped(-1, 0, $callback);
    $timer = new EvTimer(-1, 0, $callback);
    //Ev::run(Ev::RUN_NOWAIT | Ev::RUN_ONCE);

// What is the expected behaviour?
// timers are created and destructed continuosly in the loop.
// So very few of them will be actually invoked(if any).
// Isn't it?
echo "n: $n\n";
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.