From:             
Operating system: Ubuntu
PHP version:      5.3SVN-2010-10-18 (snap)
Package:          Sockets related
Bug Type:         Bug
Bug description:stream_socket_client Memory Leak when using 
stream_context_create 

Description:
------------
Using stream_socket_client on it's own works fine, but once using
stream_context_create with it it creates a memory leak of 2kb each time
which makes it unstable.

Test script:
---------------
<?php

  for ($i =0 ; $i <30 ; $i++)

  {

    $socket_options = array('socket' => array('bindto' => '127.0.0.1:0'));

    $socket_context = stream_context_create($socket_options);



    $fp=stream_socket_client('tcp://127.0.0.1:23', $error, $err, 5,
STREAM_CLIENT_ASYNC_CONNECT|STREAM_CLIENT_CONNECT, $socket_context);



    unset($socket_context);

    unset($socket_options);

    unset ($fp);

    unset ($error);

    unset ($err);clea

    

    echo memory_get_usage()."\n";

  }

?>

Expected result:
----------------
648504

650400

650400

654000

650400

650400

650400

650400

650400

650400

650400

650400

650400

650400

650400

650400

650400

....

Actual result:
--------------
648504

650400

652200

654000

655864

657664

659464

661264

663064

664864

666664

668464

670392

672192

673992

675792

677592

679392

681192

682992

684792

686592

688392

690192

691992

693792

695592

697392

699448

701248

-- 
Edit bug report at http://bugs.php.net/bug.php?id=53098&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=53098&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=53098&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=53098&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=53098&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=53098&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=53098&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=53098&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=53098&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=53098&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=53098&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=53098&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=53098&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=53098&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=53098&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=53098&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=53098&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=53098&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=53098&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=53098&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=53098&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=53098&r=mysqlcfg

Reply via email to