Edit report at http://bugs.php.net/bug.php?id=51347&edit=1
ID: 51347 User updated by: mat999 at gmail dot com Reported by: mat999 at gmail dot com Summary: mysqli_close / connection memory leak -Status: Feedback +Status: Open Type: Bug Package: MySQLi related Operating System: Debian Lenny / Linux PHP Version: 5.3.2 Assigned To: mysql New Comment: Ok tested it on php 5.3.2, sorry had issues getting php to build on my server (some hacks to get other stuff compiled have screwed with libs) Memory consumption after 0 iterations is 637088<br /> Memory consumption after 1000 iterations is 829464<br /> Memory consumption after 2000 iterations is 1021680<br /> Memory consumption after 3000 iterations is 1222080<br /> Memory consumption after 4000 iterations is 1406088<br /> Memory consumption after 5000 iterations is 1622856<br /> Memory consumption after 6000 iterations is 1806856<br /> Memory consumption after 7000 iterations is 1990864<br /> Memory consumption after 8000 iterations is 2174872<br /> Memory consumption after 9000 iterations is 2424448<br /> Memory consumption after 10000 iterations is 2608448<br /> Memory consumption after 11000 iterations is 2792464<br /> Memory consumption after 12000 iterations is 2976472<br /> Memory consumption after 13000 iterations is 3160480<br /> Memory consumption after 14000 iterations is 3344480<br /> Memory consumption after 15000 iterations is 3528496<br /> Memory consumption after 16000 iterations is 3712504<br /> Memory consumption after 17000 iterations is 4027576<br /> Memory consumption after 18000 iterations is 4211640<br /> Memory consumption after 19000 iterations is 4395640<br /> Memory consumption after 20000 iterations is 4579648<br /> Memory consumption after 21000 iterations is 4763656<br /> Memory consumption after 22000 iterations is 4947656<br /> Memory consumption after 23000 iterations is 5131672<br /> Memory consumption after 24000 iterations is 5315680<br /> Memory consumption after 25000 iterations is 5499688<br /> Memory consumption after 26000 iterations is 5683688<br /> Memory consumption after 27000 iterations is 5867704<br /> Memory consumption after 28000 iterations is 6051712<br /> Memory consumption after 29000 iterations is 6235712<br /> Memory consumption after 30000 iterations is 6419720<br /> Memory consumption after 31000 iterations is 6603736<br /> Memory consumption after 32000 iterations is 6787736<br /> Memory consumption after 33000 iterations is 7233888<br /> Memory consumption after 34000 iterations is 7417896<br /> Memory consumption after 35000 iterations is 7601912<br /> Memory consumption after 36000 iterations is 7785912<br /> Memory consumption after 37000 iterations is 7969920<br /> Memory consumption after 38000 iterations is 8153928<br /> Memory consumption after 39000 iterations is 8337928<br /> Memory consumption after 40000 iterations is 8521944<br /> Memory consumption after 41000 iterations is 8705952<br /> Memory consumption after 42000 iterations is 8889952<br /> Memory consumption after 43000 iterations is 9073960<br /> Memory consumption after 44000 iterations is 9257976<br /> Memory consumption after 45000 iterations is 9441984<br /> Memory consumption after 46000 iterations is 9625984<br /> Memory consumption after 47000 iterations is 9809992<br /> Memory consumption after 48000 iterations is 9994008<br /> Memory consumption after 49000 iterations is 10178008<br /> Memory consumption after 50000 iterations is 10362016<br /> Memory consumption after 51000 iterations is 10546024<br /> Memory consumption after 52000 iterations is 10730024<br /> Memory consumption after 53000 iterations is 10914040<br /> Memory consumption after 54000 iterations is 11098048<br /> Memory consumption after 55000 iterations is 11282056<br /> Memory consumption after 56000 iterations is 11466056<br /> Memory consumption after 57000 iterations is 11650072<br /> Memory consumption after 58000 iterations is 11834080<br /> Memory consumption after 59000 iterations is 12018080<br /> Memory consumption after 60000 iterations is 12202088<br /> Memory consumption after 61000 iterations is 12386104<br /> Memory consumption after 62000 iterations is 12570104<br /> Memory consumption after 63000 iterations is 12754112<br /> Memory consumption after 64000 iterations is 12938120<br /> Memory consumption after 65000 iterations is 13122136<br /> Memory consumption after 66000 iterations is 13830424<br /> Memory consumption after 67000 iterations is 14014432<br /> Memory consumption after 68000 iterations is 14198440<br /> Memory consumption after 69000 iterations is 14382440<br /> Memory consumption after 70000 iterations is 14566456<br /> Memory consumption after 71000 iterations is 14750464<br /> Memory consumption after 72000 iterations is 14934472<br /> Memory consumption after 73000 iterations is 15118472<br /> Memory consumption after 74000 iterations is 15302488<br /> Memory consumption after 75000 iterations is 15486496<br /> Memory consumption after 76000 iterations is 15670496<br /> Memory consumption after 77000 iterations is 15854504<br /> Memory consumption after 78000 iterations is 16038520<br /> Memory consumption after 79000 iterations is 16222520<br /> Memory consumption after 80000 iterations is 16406528<br /> Memory consumption after 81000 iterations is 16590536<br /> Memory consumption after 82000 iterations is 16774552<br /> Memory consumption after 83000 iterations is 16958552<br /> Memory consumption after 84000 iterations is 17142560<br /> Memory consumption after 85000 iterations is 17326568<br /> Memory consumption after 86000 iterations is 17510568<br /> Looks like its still there. Previous Comments: ------------------------------------------------------------------------ [2010-04-16 10:41:21] johan...@php.net Keeping it on "Feedback" till there was actual feedback. ------------------------------------------------------------------------ [2010-04-15 13:01:42] mat999 at gmail dot com ok on the weekend Ill remake my build environment and see what I can do. ------------------------------------------------------------------------ [2010-04-15 12:50:54] and...@php.net Can you try with 5.3.3-dev. I am sure I fixed this. Not a real leak, more like streams were freeing memory too late. Please try a snapshot from snaps.php.net ------------------------------------------------------------------------ [2010-04-06 07:38:40] mat999 at gmail dot com Gee, no responses on a proven bug... Heres valgrind info, sorry no debug symbols for php5-mysql [...] ==49959== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 52 from 4) --49959-- --49959-- supp: 22 dl-hack4-64bit-addr-1 --49959-- supp: 2 dl-hack3-cond-2 --49959-- supp: 27 dl-hack3-cond-1 --49959-- supp: 1 dl-hack4-64bit-addr-2 ==49959== malloc/free: in use at exit: 6,394 bytes in 22 blocks. ==49959== malloc/free: 31,095 allocs, 31,073 frees, 4,718,692 bytes allocated. ==49959== ==49959== searching for pointers to 22 not-freed blocks. ==49959== checked 1,626,688 bytes. ==49959== ==49959== 5 bytes in 1 blocks are indirectly lost in loss record 1 of 11 ==49959== at 0x4C2260E: malloc (vg_replace_malloc.c:207) ==49959== by 0x9161D71: strdup (in /lib/libc-2.7.so) ==49959== by 0x91A0036: (within /lib/libc-2.7.so) ==49959== by 0x91A1F78: getaddrinfo (in /lib/libc-2.7.so) ==49959== by 0xA5C017E: ??? ==49959== by 0xA5C030D: ??? ==49959== by 0xA5C0488: ??? ==49959== by 0xA5C04A9: ??? ==49959== by 0xA5C7D96: ??? ==49959== by 0xA38C5FC: ??? ==49959== by 0x74A6CA: zend_startup_module_ex (in /usr/bin/php5) ==49959== by 0x752E3A: zend_hash_apply (in /usr/bin/php5) ==49959== ==49959== ==49959== 12 bytes in 1 blocks are still reachable in loss record 2 of 11 ==49959== at 0x4C2260E: malloc (vg_replace_malloc.c:207) ==49959== by 0x9161D71: strdup (in /lib/libc-2.7.so) ==49959== by 0x555354: zm_startup_intl (in /usr/bin/php5) ==49959== by 0x74A6CA: zend_startup_module_ex (in /usr/bin/php5) ==49959== by 0x752E3A: zend_hash_apply (in /usr/bin/php5) ==49959== by 0x74DC29: zend_startup_modules (in /usr/bin/php5) ==49959== by 0x6F1399: php_module_startup (in /usr/bin/php5) ==49959== by 0x7D7B4C: php_cli_startup (in /usr/bin/php5) ==49959== by 0x7D850F: main (in /usr/bin/php5) ==49959== ==49959== ==49959== 12 bytes in 1 blocks are still reachable in loss record 3 of 11 ==49959== at 0x4C2260E: malloc (vg_replace_malloc.c:207) ==49959== by 0x777588D: uprv_getDefaultLocaleID_3_8 (in /usr/lib/libicuuc.so.38.1) ==49959== by 0x77AC129: (within /usr/lib/libicuuc.so.38.1) ==49959== by 0x77AC2AE: icu_3_8::Locale::getDefault() (in /usr/lib/libicuuc.so.38.1) ==49959== by 0x77AD7C8: (within /usr/lib/libicuuc.so.38.1) ==49959== by 0x55534C: zm_startup_intl (in /usr/bin/php5) ==49959== by 0x74A6CA: zend_startup_module_ex (in /usr/bin/php5) ==49959== by 0x752E3A: zend_hash_apply (in /usr/bin/php5) ==49959== by 0x74DC29: zend_startup_modules (in /usr/bin/php5) ==49959== by 0x6F1399: php_module_startup (in /usr/bin/php5) ==49959== by 0x7D7B4C: php_cli_startup (in /usr/bin/php5) ==49959== by 0x7D850F: main (in /usr/bin/php5) ==49959== ==49959== ==49959== 32 bytes in 1 blocks are still reachable in loss record 4 of 11 ==49959== at 0x4C203E4: calloc (vg_replace_malloc.c:397) ==49959== by 0x66C73DF: (within /lib/libdl-2.7.so) ==49959== by 0x66C6F20: dlopen (in /lib/libdl-2.7.so) ==49959== by 0x752274: zend_load_extension (in /usr/bin/php5) ==49959== by 0x73D30D: zend_llist_apply (in /usr/bin/php5) ==49959== by 0x6F8226: php_ini_register_extensions (in /usr/bin/php5) ==49959== by 0x6F1394: php_module_startup (in /usr/bin/php5) ==49959== by 0x7D7B4C: php_cli_startup (in /usr/bin/php5) ==49959== by 0x7D850F: main (in /usr/bin/php5) ==49959== ==49959== ==49959== 53 bytes in 2 blocks are definitely lost in loss record 5 of 11 ==49959== at 0x4C2260E: malloc (vg_replace_malloc.c:207) ==49959== by 0xA5BF317: ??? ==49959== by 0xA5C0269: ??? ==49959== by 0xA5C030D: ??? ==49959== by 0xA5C0488: ??? ==49959== by 0xA5C04A9: ??? ==49959== by 0xA5C7D96: ??? ==49959== by 0xA38C5FC: ??? ==49959== by 0x74A6CA: zend_startup_module_ex (in /usr/bin/php5) ==49959== by 0x752E3A: zend_hash_apply (in /usr/bin/php5) ==49959== by 0x74DC29: zend_startup_modules (in /usr/bin/php5) ==49959== by 0x6F1399: php_module_startup (in /usr/bin/php5) ==49959== ==49959== ==49959== 69 (64 direct, 5 indirect) bytes in 1 blocks are definitely lost in loss record 6 of 11 ==49959== at 0x4C2260E: malloc (vg_replace_malloc.c:207) ==49959== by 0x919FC83: (within /lib/libc-2.7.so) ==49959== by 0x91A1F78: getaddrinfo (in /lib/libc-2.7.so) ==49959== by 0xA5C017E: ??? ==49959== by 0xA5C030D: ??? ==49959== by 0xA5C0488: ??? ==49959== by 0xA5C04A9: ??? ==49959== by 0xA5C7D96: ??? ==49959== by 0xA38C5FC: ??? ==49959== by 0x74A6CA: zend_startup_module_ex (in /usr/bin/php5) ==49959== by 0x752E3A: zend_hash_apply (in /usr/bin/php5) ==49959== by 0x74DC29: zend_startup_modules (in /usr/bin/php5) ==49959== ==49959== ==49959== 176 bytes in 1 blocks are still reachable in loss record 7 of 11 ==49959== at 0x4C2260E: malloc (vg_replace_malloc.c:207) ==49959== by 0x77AC169: (within /usr/lib/libicuuc.so.38.1) ==49959== by 0x77AC2AE: icu_3_8::Locale::getDefault() (in /usr/lib/libicuuc.so.38.1) ==49959== by 0x77AD7C8: (within /usr/lib/libicuuc.so.38.1) ==49959== by 0x55534C: zm_startup_intl (in /usr/bin/php5) ==49959== by 0x74A6CA: zend_startup_module_ex (in /usr/bin/php5) ==49959== by 0x752E3A: zend_hash_apply (in /usr/bin/php5) ==49959== by 0x74DC29: zend_startup_modules (in /usr/bin/php5) ==49959== by 0x6F1399: php_module_startup (in /usr/bin/php5) ==49959== by 0x7D7B4C: php_cli_startup (in /usr/bin/php5) ==49959== by 0x7D850F: main (in /usr/bin/php5) ==49959== ==49959== ==49959== 672 bytes in 1 blocks are still reachable in loss record 8 of 11 ==49959== at 0x4C2260E: malloc (vg_replace_malloc.c:207) ==49959== by 0x4011429: (within /lib/ld-2.7.so) ==49959== by 0x4011A24: (within /lib/ld-2.7.so) ==49959== by 0x400D385: (within /lib/ld-2.7.so) ==49959== by 0x401111A: (within /lib/ld-2.7.so) ==49959== by 0x66C6FBA: (within /lib/libdl-2.7.so) ==49959== by 0x400D385: (within /lib/ld-2.7.so) ==49959== by 0x66C736B: (within /lib/libdl-2.7.so) ==49959== by 0x66C6F20: dlopen (in /lib/libdl-2.7.so) ==49959== by 0x66A870: php_load_extension (in /usr/bin/php5) ==49959== by 0x73D30D: zend_llist_apply (in /usr/bin/php5) ==49959== by 0x6F8239: php_ini_register_extensions (in /usr/bin/php5) ==49959== ==49959== ==49959== 1,272 bytes in 11 blocks are still reachable in loss record 9 of 11 ==49959== at 0x4C2260E: malloc (vg_replace_malloc.c:207) ==49959== by 0x59BB8F2: CRYPTO_malloc (in /usr/lib/libcrypto.so.0.9.8) ==49959== by 0x5A1C2DE: sk_new (in /usr/lib/libcrypto.so.0.9.8) ==49959== by 0x572D649: (within /usr/lib/libssl.so.0.9.8) ==49959== by 0x572D858: SSL_COMP_get_compression_methods (in /usr/lib/libssl.so.0.9.8) ==49959== by 0x5733A0F: SSL_library_init (in /usr/lib/libssl.so.0.9.8) ==49959== by 0x468BCE: zm_startup_openssl (in /usr/bin/php5) ==49959== by 0x74A6CA: zend_startup_module_ex (in /usr/bin/php5) ==49959== by 0x752E3A: zend_hash_apply (in /usr/bin/php5) ==49959== by 0x74DC29: zend_startup_modules (in /usr/bin/php5) ==49959== by 0x6F1399: php_module_startup (in /usr/bin/php5) ==49959== by 0x7D7B4C: php_cli_startup (in /usr/bin/php5) ==49959== ==49959== ==49959== 2,048 bytes in 1 blocks are still reachable in loss record 10 of 11 ==49959== at 0x4C2260E: malloc (vg_replace_malloc.c:207) ==49959== by 0x753619: _zend_hash_init (in /usr/bin/php5) ==49959== by 0x75366C: _zend_hash_init_ex (in /usr/bin/php5) ==49959== by 0x7472D5: zend_startup (in /usr/bin/php5) ==49959== by 0x6F0DCF: php_module_startup (in /usr/bin/php5) ==49959== by 0x7D7B4C: php_cli_startup (in /usr/bin/php5) ==49959== by 0x7D850F: main (in /usr/bin/php5) ==49959== ==49959== ==49959== 2,048 bytes in 1 blocks are still reachable in loss record 11 of 11 ==49959== at 0x4C2260E: malloc (vg_replace_malloc.c:207) ==49959== by 0x73DC8D: zend_llist_init (in /usr/bin/php5) ==49959== by 0x6FA902: sapi_activate (in /usr/bin/php5) ==49959== by 0x6F0CB3: php_module_startup (in /usr/bin/php5) ==49959== by 0x7D7B4C: php_cli_startup (in /usr/bin/php5) ==49959== by 0x7D850F: main (in /usr/bin/php5) ==49959== ==49959== LEAK SUMMARY: ==49959== definitely lost: 117 bytes in 3 blocks. ==49959== indirectly lost: 5 bytes in 1 blocks. ==49959== possibly lost: 0 bytes in 0 blocks. ==49959== still reachable: 6,272 bytes in 18 blocks. ==49959== suppressed: 0 bytes in 0 blocks. --49959-- memcheck: sanity checks: 50 cheap, 4 expensive --49959-- memcheck: auxmaps: 0 auxmap entries (0k, 0M) in use --49959-- memcheck: auxmaps_L1: 0 searches, 0 cmps, ratio 0:10 --49959-- memcheck: auxmaps_L2: 0 searches, 0 nodes --49959-- memcheck: SMs: n_issued = 161 (2576k, 2M) --49959-- memcheck: SMs: n_deissued = 9 (144k, 0M) --49959-- memcheck: SMs: max_noaccess = 524287 (8388592k, 8191M) --49959-- memcheck: SMs: max_undefined = 14 (224k, 0M) --49959-- memcheck: SMs: max_defined = 2155 (34480k, 33M) --49959-- memcheck: SMs: max_non_DSM = 160 (2560k, 2M) --49959-- memcheck: max sec V bit nodes: 8 (0k, 0M) --49959-- memcheck: set_sec_vbits8 calls: 13 (new: 8, updates: 5) --49959-- memcheck: max shadow mem size: 6704k, 6M --49959-- translate: fast SP updates identified: 21,056 ( 84.1%) --49959-- translate: generic_known SP updates identified: 3,640 ( 14.5%) --49959-- translate: generic_unknown SP updates identified: 331 ( 1.3%) --49959-- tt/tc: 44,478 tt lookups requiring 53,263 probes --49959-- tt/tc: 44,478 fast-cache updates, 24 flushes --49959-- transtab: new 18,748 (589,533 -> 7,876,845; ratio 133:10) [0 scs] --49959-- transtab: dumped 0 (0 -> ??) --49959-- transtab: discarded 1,820 (46,106 -> ??) --49959-- scheduler: 5,020,598 jumps (bb entries). --49959-- scheduler: 50/88,483 major/minor sched events. --49959-- sanity: 51 cheap, 4 expensive checks. --49959-- exectx: 12,289 lists, 10,787 contexts (avg 0 per list) --49959-- exectx: 62,188 searches, 59,102 full compares (950 per 1000) --49959-- exectx: 65 cmp2, 444 cmp4, 0 cmpAll --49959-- errormgr: 44 supplist searches, 1,362 comparisons during search --49959-- errormgr: 52 errlist searches, 607 comparisons during search ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=51347 -- Edit this bug report at http://bugs.php.net/bug.php?id=51347&edit=1