Return to bug61371.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / streams |
1.1 misho 1: --TEST-- 2: Bug #61371: stream_context_create() causes memory leaks on use streams_socket_create 1.1.1.2 ! misho 3: --SKIPIF-- ! 4: <?php ! 5: if(substr(PHP_OS, 0, 3) == 'WIN' ) { ! 6: die('skip non windows test'); ! 7: } 1.1 misho 8: --FILE-- 9: <?php 10: function test($doFclose) { 11: $previous = null; 12: $current = null; 13: for($test=1;$test<=3;$test++) { 14: $current = memory_get_usage(true); 15: if (!is_null($previous)) { 16: var_dump($previous == $current); 17: } 18: $previous = $current; 19: echo 'memory: '.round($current / 1024, 0)."kb\n"; 20: for($i=0;$i<=100;$i++) { 21: $context = stream_context_create(array()); 22: $stream = stream_socket_client('udp://0.0.0.0:80', $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $context); 23: if ($doFclose) fclose($stream); 24: unset($context); 25: unset($stream); 26: unset($errno); 27: unset($errstr); 28: } 29: } 30: } 31: 32: test(true); 33: test(false); 34: ?> 35: --EXPECTF-- 36: memory: %dkb 37: bool(true) 38: memory: %dkb 39: bool(true) 40: memory: %dkb 41: memory: %dkb 42: bool(true) 43: memory: %dkb 44: bool(true) 45: memory: %dkb