|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-10-29 23:38 UTC] felipe@php.net
[2009-02-13 02:23 UTC] felipe@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 19:00:01 2025 UTC |
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. nixnutz@ulflinux:~/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: --------------- nixnutz@ulflinux:~/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.