CodeIgniter Forums
Fatal error: Allowed memory size exhausted - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Fatal error: Allowed memory size exhausted (/showthread.php?tid=31452)



Fatal error: Allowed memory size exhausted - El Forum - 06-19-2010

[eluser]iConTM[/eluser]
I have some memory issues in my application.

The problem occurred when I added a second database to the party.

In the MY_Model class I load the 2 databases.
so each submodel can access the objects.

Code:
class MY_Model extends Model {

    protected static $_db1 = null;
    protected static $_db2 = null;

    function MY_Model()
    {
        parent::Model();
        
        if (!self::$_db1)
            self::$_db1  = $this->load->database('db1', true);
        
        if (!self::$_db2)
            self::$_db2 = $this->load->database('db2', true);
        
    }
    
}

is this a good practice and why does it absorbe so much memory?


Fatal error: Allowed memory size exhausted - El Forum - 06-20-2010

[eluser]InsiteFX[/eluser]
Did you check your memory settings in php.ini?

InsiteFX