logo       

httpd keep the memory allocated even after the script ends: msg#00638

Subject: httpd keep the memory allocated even after the script ends
Hi.

I am testing some ways to insert bin 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 wich the data is inserted ha the following structure:

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


the script is attached:

<?
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);
if(!OCIFreeStatement($my_res)){
   echo "\n<p> Problems to free the statement mname<p>\n";
   return 5;
};

$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);

echo "\n<p> Before free :".$cname->size()."<p>\n";

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


//Drop types
$dtque=OCIParse($link,"drop type mname");
if(!OCIExecute($dtque)){
   echo("Problems with dropping MNAME type <p>");
   return 5;
};
OCIFreeStatement($dtque);

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

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

};



function query_num($link){
  $qres=OCIParse($link, "select count(*) from adrian_test");
  $retv=OCIExecute($qres,OCI_COMMIT_ON_SUCCESS);
  OCIFetchInto($qres, $rdata, OCI_RETURN_NULLS);
  OCIFreeStatement($qres);
  return $rdata[0];

};

function trash_all($link){
  $qres=OCIParse($link, "delete from adrian_test");
  OCIExecute($qres,OCI_COMMIT_ON_SUCCESS);
  OCIFreeStatement($qres);
};


$linkid = OCINLogon("user", "pass", "db");

if (!$linkid) {
   echo "Connection failed";
   echo "Error Message: [" . OCIError($linkid) . "]";
   exit;
};

trash_all($linkid);


for($cc=0;$cc<20;$cc++){
echo "\n\n\n<p>-----------------------------TEST $cc START-------------------------------------------------<p>\n";
   bulk_test($linkid,100000);
if(query_num($linkid)!=100000) echo "\n<p> ------------------------- Error in step $cc ----------------------------------<p>\n";
   trash_all($linkid);
   flush();
   OCICommit($linkid);
echo "\n\n\n<p>-----------------------------TEST $cc END-------------------------------------------------<p>\n";
 };

OciLogOff($linkid);
?>



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe