[eluser]tonanbarbarian[/eluser]
any variable that is created inside a function, and is not static, is supposed to only exist while that function is executing.
so if you have a variable in your model and you store a dataset of 1000 records in it and then return that data, the variable inside the function should cease to exist as soon as the return is finished returning the value.
the controller method that is called is really no different.
the call to load->view() with data passed to it stores the view data to be used in a variable of the load object of the controller.
so if you are running the index method of the controller and you cal a model and store the results in a variable called $data, and then pass $data to the view using $this->load->view() or any of the normal CI methods of setting view data, then once the index function has finished $data no longer exists
the core CI code does extra processing after the controller method has processed to then finish displaying the view.
if you override the display of the view and force it to process in the controller then you do use more memory
however in all of this you do have to consider that it is true that at any given time in the processing any dataset you pass between model, controller and view is likely to exist in memory twice at least temporarily.
I am not sure how PHP actually handles things, it may just use pointers and move the data around when you return it from a function, but it might have to briefly have 2 copies of it.
This means that technical the memory_get_peak_usage() may be higher than expected.
Personally I would like some way to be able to retrieve results from a query one at a time if needed
maybe this will come in future versions of CI
If you are still concerned about this then I would suggest turning on the profilers and if necessary adding some more profiling of your own to determine the memory_get_usage() and memory_get_peak_usage() of the code and strategic places in your code.