Most likely you are trying to load too many objects to memory.
This is just a random guess but if you are using getCollection() as retrieval function for query. It will load all of the objects to you RAM which then again is controlled by PHP memory setting etc...
Use newQuery() and limit() method from that class to reduce the memory consumption.
Unfortunately there is no mathematical way to say how many objects you can retrieve as it is in whole really dependant on your database and size of what the retrieved fields has,
Almost retired from web-development industry but still randomly writing at Lazylegs.info and on schedule hopefully in near future to finish Oracle and PostgreSQL ports of MODX
Using getIterator() instead of getCollection() can reduce the memory load (the args are the same).
You may also have a circular reference somewhere.
If this doesn't help, you'll have to tell us more about what you're doing.
------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using.
MODX info for everyone:
http://bobsguides.com/modx.html
Hi, I forgot to write that it happens when I use getResources &resources=`14` &tpl=`content`
There is only one paragraph in this resource and content is build of *content
Try to remove the &tpl parameter. That will make getResources output the result as an array listing. In that way, you will see how big your resultset is.
discuss.answer
-
MODX Staff
- 10,725 Posts
By default getResources does not select the content of the Resource. This would take extra memory when content is not used, so you need to add the &includeContent=`1` property in the snippet in order to output the content of the Resource.