Memory and Doctrine 1.2

When dealing with doctrine 1.2 and medium data, you will probably see something like this:

Fatal error: Allowed memory size of X bytes exhausted (tried to allocate X bytes)

To avoid this you should care about the following points:

1. If you only want to read data fetch it as an array. Nobody needs an overloaded active record while read only.


2. Select only the data you need – especially when using multiple inner joins.

$q->select('u.id, u.email, u.slug')
$q->from('User u')

3. Use pagination while using active records

4. Use free on objects you dont need any longer when using php <= 5.2.5


Passion for sports with boards, climbing, mountain biking, traveling, photography, videography and software engineering. /n/n Heilbronn // Germany

Leave a Reply