Welcome Guest, Not a member yet? Register   Sign In
Class referencing appears a memory leak
#7

[eluser]dyron[/eluser]
Good morning,

a half sleepless night figured out, that the multiple loading of models increases the data.

For debugging things I var_dumps $this in the calendaring class. If I call no models in the current controller, the output file is 106KB big. If I call one model, the file is 626KB and so on. Up to ~230MB for 4 model loads.
Code:
class Home extends Controller {

  function __construct()
  {
    parent::Controller();

    $this->load->library('calendar', array(...));
    $this->load->library('page', array(...));

    $this->load->model('Blog_model', 'blog');
    $this->load->model('Forums_model', 'forums');
    $this->load->model('User_model', 'users');
    $this->load->model('Match_model', 'matches');
  }
    
  function index($year = '', $month = '')
  {
  }
}

All models are based equally
Code:
class Blog_model extends Model {

  function Blog_model()
  {
    parent::Model();
  }

  ...
}

So I started logging the application init
Quote:DEBUG - 2007-11-01 08:10:01 --> Config Class Initialized
DEBUG - 2007-11-01 08:10:01 --> Hooks Class Initialized
DEBUG - 2007-11-01 08:10:01 --> Router Class Initialized
DEBUG - 2007-11-01 08:10:01 --> Output Class Initialized
DEBUG - 2007-11-01 08:10:01 --> Input Class Initialized
DEBUG - 2007-11-01 08:10:01 --> XSS Filtering completed
DEBUG - 2007-11-01 08:10:01 --> XSS Filtering completed
DEBUG - 2007-11-01 08:10:01 --> Global POST and COOKIE data sanitized
DEBUG - 2007-11-01 08:10:01 --> URI Class Initialized
DEBUG - 2007-11-01 08:10:01 --> Language Class Initialized
DEBUG - 2007-11-01 08:10:01 --> Loader Class Initialized
DEBUG - 2007-11-01 08:10:01 --> Helpers loaded: error, lang, url
DEBUG - 2007-11-01 08:10:01 --> Language file loaded: language/german/common_lang.php
DEBUG - 2007-11-01 08:10:01 --> Database Driver Class Initialized
ERROR - 2007-11-01 08:10:01 --> Severity: Warning --> mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given ..\system\database\drivers\mysqli\mysqli_result.php 37
DEBUG - 2007-11-01 08:10:01 --> Session Class Initialized
DEBUG - 2007-11-01 08:10:01 --> Controller Class Initialized
DEBUG - 2007-11-01 08:10:01 --> Model Class Initialized

DEBUG - 2007-11-01 08:10:01 --> Config Class Initialized
DEBUG - 2007-11-01 08:10:01 --> Hooks Class Initialized
DEBUG - 2007-11-01 08:10:01 --> Router Class Initialized
DEBUG - 2007-11-01 08:10:01 --> Output Class Initialized
DEBUG - 2007-11-01 08:10:01 --> Input Class Initialized
DEBUG - 2007-11-01 08:10:01 --> XSS Filtering completed
DEBUG - 2007-11-01 08:10:01 --> XSS Filtering completed
DEBUG - 2007-11-01 08:10:01 --> Global POST and COOKIE data sanitized
DEBUG - 2007-11-01 08:10:01 --> URI Class Initialized
DEBUG - 2007-11-01 08:10:01 --> Language Class Initialized
DEBUG - 2007-11-01 08:10:01 --> Loader Class Initialized
DEBUG - 2007-11-01 08:10:01 --> Helpers loaded: error, lang, url
DEBUG - 2007-11-01 08:10:01 --> Language file loaded: language/german/common_lang.php
DEBUG - 2007-11-01 08:10:01 --> Database Driver Class Initialized
ERROR - 2007-11-01 08:10:01 --> Severity: Warning --> mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given ..\system\database\drivers\mysqli\mysqli_result.php 37
DEBUG - 2007-11-01 08:10:01 --> Session Class Initialized
DEBUG - 2007-11-01 08:10:01 --> Controller Class Initialized
DEBUG - 2007-11-01 08:10:02 --> Language file loaded: language/german/calendar_lang.php
DEBUG - 2007-11-01 08:10:02 --> Calendar Class Initialized

Why initialize it a second time? Which file content is necessary too?

UPDATE:
I found out, that calling
Code:
$this->CI =& get_instance();
in the page class constructor causes the second time.


Messages In This Thread
Class referencing appears a memory leak - by El Forum - 10-31-2007, 10:53 AM
Class referencing appears a memory leak - by El Forum - 10-31-2007, 11:23 AM
Class referencing appears a memory leak - by El Forum - 10-31-2007, 11:37 AM
Class referencing appears a memory leak - by El Forum - 10-31-2007, 11:53 AM
Class referencing appears a memory leak - by El Forum - 10-31-2007, 12:15 PM
Class referencing appears a memory leak - by El Forum - 10-31-2007, 12:34 PM
Class referencing appears a memory leak - by El Forum - 11-01-2007, 01:20 AM
Class referencing appears a memory leak - by El Forum - 11-01-2007, 02:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB