From:             uwendel at mysql dot com
Operating system: Linux 64bit
PHP version:      5.3CVS-2008-07-04 (CVS)
PHP Bug Type:     PDO related
Bug description:  PDO: persistent connection leak

Description:
------------
Creating a persistent connection handle and assigning a new persistent
connection to the same handle (variable) causes a leak.

$db = new PDO(...)
$db = new PDO(...) <--- leak


My PHP 5.3 CVS snapshot is a little older than 04.07.2008, anyway.
[EMAIL PROTECTED]:~/php53> sapi/cli/php -v
PHP 5.3.0-dev (cli) (built: Jul  3 2008 16:20:01) (DEBUG)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2008 Zend Technologies


Reproduce code:
---------------
[EMAIL PROTECTED]:~/php53> valgrind sapi/cli/php -r '$db = new 

PDO("sqlite:/tmp/foo", NULL, NULL, array(PDO::ATTR_PERSISTENT => true));
$db = new PDO("sqlite:/tmp/foo", NULL, NULL, array(PDO::ATTR_PERSISTENT =>
true));'
==32328== Memcheck, a memory error detector.
==32328== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==32328== Using LibVEX rev 1804, a library for dynamic binary
translation.
==32328== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==32328== Using valgrind-3.3.0, a dynamic binary instrumentation
framework.
==32328== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==32328== For more details, rerun with: -v
[Fri Jul  4 19:35:02 2008]  Script:  '-'
/home/nixnutz/php53/ext/pdo/pdo_dbh.c(1513) :  Freeing 0x0655C3C8 (72
bytes), script=-
[Fri Jul  4 19:35:02 2008]  Script:  '-'
/home/nixnutz/php53/ext/pdo/pdo_dbh.c(1514) :  Freeing 0x0655C468 (64
bytes), script=-
/home/nixnutz/php53/Zend/zend_alloc.c(2374) : Actual location (location
was relayed)
=== Total 2 memory leaks detected ===
==32328==
==32328== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
==32328== malloc/free: in use at exit: 91,869 bytes in 137 blocks.
==32328== malloc/free: 11,910 allocs, 11,773 frees, 3,125,629 bytes
allocated.
==32328== For counts of detected errors, rerun with: -v
==32328== searching for pointers to 137 not-freed blocks.
==32328== checked 558,296 bytes.
==32328==
==32328== LEAK SUMMARY:
==32328==    definitely lost: 11,325 bytes in 128 blocks.
==32328==      possibly lost: 456 bytes in 6 blocks.
==32328==    still reachable: 80,088 bytes in 3 blocks.
==32328==         suppressed: 0 bytes in 0 blocks.
==32328== Rerun with --leak-check=full to see details of leaked memory.



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

Reply via email to