1--TEST--
2Check for uv_write has no memory leak
3--FILE--
4<?php
5class TestCase {
6    public $counter = 0;
7
8    public function run() {
9        $loop = uv_loop_new();
10
11        $handler = uv_pipe_init($loop, false);
12        uv_pipe_open($handler, (int) STDOUT);
13
14        $a = 0;
15
16        while (++$a <= 1000) {
17            uv_write($handler, '', function() {
18                $this->counter++;
19            });
20        }
21
22        uv_run($loop, \UV::RUN_DEFAULT);
23        uv_close($handler);
24    }
25}
26
27$t = new TestCase;
28
29$memory = memory_get_usage();
30
31$t->run();
32
33$memory = memory_get_usage() - $memory;
34
35echo "$t->counter\n$memory\n";
36--EXPECTF--
371000
380
39