0

Fatal error: Allowed memory size of 194217728 bytes exhausted (tried to allocate 261904 bytes) in C:\xampp\htdocs\test\ci\application\libraries\datamapper.php on line 5

What is the problem? It works right but when trying to run any datamapper functions that error comes.

The database config is correct in ../config/database.php

Seki
  • 11,135
  • 7
  • 46
  • 70
  • Datamapper itself doesn't use that much memory, other then for the code and the internal data structures. You don't provide the code that triggers the error, but know that every record will be converted into an object. A get() of 10.000 records is definately a bad idea. Also, there is no code at line 5 of the datamapper library, so something weird is going on here... – WanWizard May 16 '12 at 19:27
  • you are right that error comes when i tried to make get() function class User extends DataMapper { public $table="user"; function get(){ $o = new User(); return $o->get(); } – Mohammed Gomma May 17 '12 at 08:30
  • when i made return $o->get_where(array('id' => 53),1,"0"); } – Mohammed Gomma May 17 '12 at 08:32
  • Fatal error: Call to protected method CI_DB_active_record::_where() from context 'DataMapper' in C:\xampp\htdocs\test\ci\application\libraries\datamapper.php on line 1504 – Mohammed Gomma May 17 '12 at 08:33

1 Answers1

1

This a memory problem. Something in your code is eating memory. You can use memory_get_peak_usage() and memory_get_usage() to better understand what's going on or use a profiler like xdebug+webgrind.

http://us3.php.net/manual/en/function.memory-get-usage.php http://us3.php.net/manual/en/function.memory-get-peak-usage.php https://github.com/jokkedk/webgrind

alganet
  • 2,527
  • 13
  • 24