ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-dev
php-dev
#50111 [NEW]: memory leak when stream_context_create is used
by Datibbaw@Php.Net other posts by this author
Nov 7 2009 1:27AM messages near this date
#50112 [Opn->Asn]: compile error with Non-Engish Operating system | #50111 [Opn->WFx]: memory not properly freed when stream_context_create is used (PHP_5_2 only!)
From:             datibbaw@[...].net
Operating system: Linux
PHP version:      5.2.11
PHP Bug Type:     Streams related
Bug description:  memory leak when stream_context_create is used

Description:
------------
When stream_context_create() is used in conjunction with
file_get_contents() or other stream related functions that accept a context
parameter, memory is being leaked.

Reproduce code:
---------------
for ($i=0;$i<5;++$i){
  $m0 = memory_get_usage();
  file_get_contents('http://www.google.com', false,
stream_context_create(array()));
  $m1 = memory_get_usage();
  echo $m1-$m0,PHP_EOL;
}

Expected result:
----------------
X (where X is the memory increase for the first iterator)
0
0
0
0


Actual result:
--------------
X (where X is the memory increase for the first iterator)
384 (or something similar)
420
420
480

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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved