[eluser]J3roen[/eluser]
I encountered a problem when inserting lot's of data in a mysql database.
The memory used keeps increasing every insert query, for some reason
it saves some data somewhere? Shouldn't it clear the data after every insert?
Using version 1.7.
To reproduce:
Code:
CREATE TABLE `yourdatabase`.`test` (
`id` INT NOT NULL AUTO_INCREMENT ,
`data` BLOB NOT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM
Code:
<?
class Test extends Controller {
function Test()
{
parent::Controller();
}
function index()
{
for($i = 0; $i < 200; $i++) {
$data['data'] = file_get_contents("/path/to/some/file");
$this->db->insert('test', $data);
$image_id = $this->db->insert_id();
echo round(memory_get_usage() / 1024 / 1024, 2) . "<br />";
flush();
}
}
}
?>
Produces:
Code:
2.8
3.42
<SNIP>
103.88
104.51
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 654047 bytes) in /home/websites/blabla/code/database/drivers/mysql/mysql_driver.php on line 488