#40889 [Opn->Fbk]: Coll->assignElem(n,"str") and Coll->append("str") causes memory leak
| From: | tony2001@php.net | Date: | Thu, 22 Mar 2007 10:26:41 +0000 |
| Subject: | #40889 [Opn->Fbk]: Coll->assignElem(n,"str") and Coll->append("str") causes memory leak | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-110670@lists.php.net to get a copy of this message | ||
ID: 40889
Updated by: tony2001@php.net
Reported By: uno at venus dot dti dot ne dot jp
-Status: Open
+Status: Feedback
Bug Type: OCI8 related
Operating System: Linux
PHP Version: 4.4.6
New Comment:
Are you using OCI8 from PECL?
If yes, which version?
Previous Comments:
------------------------------------------------------------------------
[2007-03-22 09:01:51] uno at venus dot dti dot ne dot jp
Description:
------------
I found that
coll->append("string");
or
coll->assignElem(n,"string");
cause memory leak.
You need to free OCIAssignText()'ed strings with OCIStringResize() in
oci8.c (PHP 4.4.6) and oci8_collection.c (PHP 5.2.1, PECL/oci8-1.2.3)
because OCICollAppend() and OCICollAssignElem() perform deep-copy of
element value.
see:
http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14250/oci18map001.htm#i448982
http://download-east.oracle.com/docs/cd/A58617_01/server.804/a58234/orl_func.htm#426353
Reproduce code:
---------------
$collStr = ocinewcollection( ... );
$collStr->append("string"); /* memory leak */
$collStr->assignElem(0,"string"); /* memory leak */
$collNum = ocinewcollection( ... );
$collNum->append(1234); /* no memory leak */
$collNum->assignElem(0, 5678); /* no memory leak */
$collDate = ocinewcollection( ... );
$collDate->append("2007-01-01"); /* no memory leak */
$collDate->assignElem(0, "2007-02-02"); /* no memory leak */
Expected result:
----------------
no memory leak
Actual result:
--------------
memory leak
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40889&edit=1