I used PHP's memory_get_usage(). Did the trick.

Before my beforeFilter() even runs, cake is using between 6M and 7M of
memory for my app. That is enormous, especially since in PHP4 the
limit is 8M.

Are other people experiencing similiar memory usage?

I am guessing this is due to the model associations graph cake builds
for each request based on the current controller's model. I am not
sure of this though, since I haven't been able to break down the
memory usage more granularly.

The sad thing is,  although the controller's model is heavily
associated with other models (and as a result cake builds this huge
recursive network of models spanning almost my entire model universe),
there are only a few small queries in the controller which need at
most 4-5 models - never all 25.

In fact, at no time does any request in my entire app need all the
models.

So, I guess I have two questions:

1. What is the reason cake builds the full model association graph,
when it is very unlikely that more than only a few associations will
be needed in any request, by any controller, and the building of this
huge graph becomes a waste of time/resources?  Why not just build/
increment the graph on an "as needed" basis based on the queries
executed in the controller?

2. Given that I'm not going to change the way cake's core works, what
should I do to minimize this enormous model graph? Do I have to start
removing associations from the models? That is alot of work/
retesting.

Are there any bakery, or other, approaches for dealing with this? I am
certain I am not the first to stumble upon this.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to