Oracle Instant Client and PHP memory leak(s)
557199Jan 3 2008 — edited Jan 25 2008So recently we ran into a rather interesting problem. One of our developers was writing an import script that would import data into Oracle 10g database and he noticed that his script would slowly eat more and more memory as it did the import. I spent some time investigating and after creating a very basic PHP script and running it from the command-line through valgrind it seems that Oracle Instanct Client library is leaking memory.
Operating System: linux (Mandriva 2008) - 32 bit
PHP: 5.2.4
Oracle Instant Client: 10.2.0.3 (and then upgraded to 11.1.0.1) using Oracle provided RPMS.
OCI8 extension: 1.2.4 (taken from PECL)
Sample Script:
<?php
print "PHP Stress Test!\n";
$conn = oci_connect('scott', 'tiger', 'xxxxx');
for ($i = 1; $i < 100; $i++) {
print "#$i: " . memory_get_usage() . "\n";
$s = oci_parse($conn, "SELECT 1 FROM dual");
oci_execute($s);
$r = oci_fetch_row($s);
oci_free_statement($s);
}
?>
ran valgrind with the following options:
valgrind tool=memcheck show-reachable=yes --leak-check=full php stress.php 2>valgrind.dump
also for this script it seems that as far as PHP is concerned memory is not being leaked, but valgrind produces a file of about 350k.
P.S. I just upgarded to 11.1.0.1 using the Oracle provided Linux x86 RPMS and it seems that I can't use basiclite since sqlplus and dev packages require basic.
Gena01