Within reason, there is still a memory footprint that's linear with the number of entities so you will run out of memory at some point. How many entities depends on a number of factors (amount of metadata for example, now that all metadata is loaded with the entity).
Once the ElggBatch bug is fixed it's definitely better use ElggBatch wherever possible. You'll still have linear time increases while processing lots of entities but won't have OOM issues.
ok I see...thank you Matt for all your explanations and congratulations for your work on Elgg (it is an amazing tool)..and I read that to reproduce the ElggBatch bug you grab something like 25000 users ..well by the time I will have that many users I sure the bug is going to be solved ;-)
If you don't need them, you can improve performance by not creating the user entities (pass 'callback' => '' to elgg_get_entities). You'll get stdClass DB rows instead of ElggUser objects.
We're not sure the source of the memory leak but I suspect the DB query cache, which stores all result sets and currently has no cache limit. Cash Costello is working on an LRU cache for this (and other memory) caches.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.