Yii 1.1.3: Memory leak in CDbCommand->execute()


I am using oci8pdo extension for Oracle DB and running following code.

 private function runInsertCommand($inserts, $params, $connection, $log = false)


        //Here we will insert the records to table.

        $query = $this->structureQuery($inserts);

        $command = $connection->createCommand($query);


        // for checking memory usage

        echo memory_get_usage();


        echo memory_get_usage();


The query insert 100 records. Each time $command->execute() is called, roughly 2MB increased. With 200 records, the memory spike to 4MB (each time), 2,000 records, the memory usage is 40MB and so on! I already tried setting YII_DEBUG = false, unsetting all the variables and still to no avail.

Updated: I tried using MySql 5.3.3 version and facing the same issue!

Later, i have implemented my own function to insert into database.

$conn = oci_pconnect($username, $password, $database);

$this->conn = $conn;

$parsed = @oci_parse($this->conn, $sql);

$this->stmt = $parsed;

$clob = array();

//bind parameters

foreach($this->params as $key=>$value){

    $clob[$key] = oci_new_descriptor($this->conn, OCI_D_LOB);


         self::logData("ERROR BINDING PARAMS");





Using the above code, no memory leak at all. I have inserted over a million records in MySql and Oracle! Can someone fix the CDbCommand for insertion? (Note that the issue occurred in Insertion only. No memory leak found in Selection)