From:             adri_l at gmx dot net
Operating system: Suse Linux 8.1
PHP version:      4.3.1
PHP Bug Type:     OCI8 related
Bug description:  after using oci colections the httpd process keeps the memory 
allocated

Hi.
 
 I am testing some ways to insert big amounts of data
 in a oracle database and i encountered the following   problem.
 
 During the script execution the memory usage of httpd daemon grows a lot
and even after the script is ended the httpd process keeps the memory
allocated. After two runs of the script the httpd process is using 28.7%
of 512 MB of RAM.
 
 I'm using PHP 4.3.1, Oracle 9.2.1.0.1 and apache 1.3.27.
 
 Hope you can help.
 
 The oracle table in which the data is inserted has the following
structure:

SQL> describe adrian_test;
Name        Null?    Type
----------- -------- -----------------
NAME                 VARCHAR2(255)
NR                   NUMBER
VAL                  NUMBER

The script is: 

<?
OCIInternalDebug (1);


function bulk_test($link,$nr_query){

 // Create three types number, float, text
$my_q="create or replace type mname as varray($nr_query) of
varchar(255)";
$my_res=OCIParse($link,$my_q);
OCIExecute($my_res);
OCIFreeStatement($my_res);

$my_q="create or replace type mnr as varray($nr_query) of number";
$my_res=OCIParse($link,$my_q);
OCIExecute($my_res);
OCIFreeStatement($my_res);

$my_q="create or replace type mval as varray($nr_query) of number";
$my_res=OCIParse($link,$my_q);
OCIExecute($my_res);
OCIFreeStatement($my_res);

//Create collections
$cname=OCINewCollection($link,"MNAME");
$cnr=OCINewCollection($link,"MNR");
$cval=OCINewCollection($link,"MVAL");


//Create bulk data
for($i=0;$i<$nr_query;$i++){
   $cname->append("Nume".$i); 
   $cval->append($i);
   $cnr->append($i+100);
};

//Create the PLSQL query
$mbstr="begin forall i in 1..".$nr_query." insert into adrian_test
(name,nr,val) values (:vname(i),:vnr(i),:vval(i));end;";
$mbq=OCIParse($link,$mbstr);

//Bind collections
OCIBindByName($mbq,":vname",$cname,sizeof($cname),OCI_B_SQLT_NTY);
OCIBindByName($mbq,":vnr",$cnr,sizeof($cnr),OCI_B_SQLT_NTY);
OCIBindByName($mbq,":vval",$cval,sizeof($cval),OCI_B_SQLT_NTY);

//Execute Query
OCIExecute($mbq);
OCIFreeStatement($mbq);


//Free Collections
$cname->free();
$cnr->free();
$cval->free();


//Drop types
$dtque=OCIParse($link,"drop type mname");
OCIExecute($dtque);
OCIFreeStatement($dtque);

$dtque=OCIParse($link,"drop type mnr");
OCIExecute($dtque);
OCIFreeStatement($dtque);

$dtque=OCIParse($link,"drop type mval");
OCIExecute($dtque);
OCIFreeStatement($dtque);

};

$linkid = OCINLogon("scott", "tiger");
bulk_test($linkid,500000);

?>


I hope this can be solved easily and that i'm not reporting false bugs or
things like this.

Best regards,

Adrian CIocildau
-- 
Edit bug report at http://bugs.php.net/?id=22532&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22532&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22532&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22532&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22532&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22532&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22532&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22532&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22532&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22532&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22532&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22532&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22532&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22532&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22532&r=gnused

Reply via email to