memory leak?

[email protected] (janus) Thu, 15 Jun 2000 10:37:22 +0800
Newsgroups php.version4
Message-ID <[email protected]>
Hi all,

I'm new to both PHP and Oracle. I've installed Oracle 8.1.6 and PHP
4.0.0 on RedHat 6.1. I've wrote a testing script to connect to Oracle
and display the content of a table. It did succeed, however, it seems
have memory leak. Each time I reload the testing page from the browser,
it consumes memory! Isn't that every I logoff Oracle, the memory would
be released? I can't see it happens! Could anyone help?

Here's my code:
<?

putenv("ORACLE_HOME=/usr/local/oracle/8i/u01/app/oracle/product/8.1.6");

  putenv("ORACLE_SID=SWCO");

  if ($connection = ora_logon("scott", "tiger")) {
    if ($cursor = ora_open($connection)) {
       $query = "select * from php_test ";

       if (ora_parse($cursor, $query)) {
          if (ora_exec($cursor)) {
             while (ora_fetch($cursor)) {
                for ($idx=0; $idx< ora_numcols($cursor); $idx++) {
                   print (ora_getcolumn($cursor, $idx));
                   print '&nbsp;';
                }
                print "<br>\n";
             }
             print "<br>\n";
             print (ora_numrows($cursor));
             print "<br>\n";
          } else {
             print "<b>ora_exec Error</b><br>\n";
             print ("Error Code: ");
             print (ora_errorcode($cursor));
             print "<br>\n";
             print "Error Messages: ";
             print (ora_error($cursor));
             print "<br>\n";
          }
       } else {
          print "<b>ora_parse Error</b><br>\n";
          print ("Error Code: ");
          print (ora_errorcode($cursor));
          print "<br>\n";
          print "Error Messages: ";
          print (ora_error($cursor));
          print "<br>\n";
       }
       ora_close($cursor);
    } else {
      print "Cursor couldn't be opened!<br>\n";
    }

    ora_logoff($connection);
  }
?>


Greetings,
Janus