Getting files from fileset, memory limit exceeded $fl->get();

Permalink
I'm creating a block that will display images in a certain way from a chosen fileset but when I try, I get the following error.
Allowed memory size of 134217728 bytes exhausted (tried to allocate 110362624 bytes)


If I comment out the link $files = $fl->get(); then it works (except the $files array is empty)

I've tried using FileSet::getByID and by name and tried hardcoding the fileset name

if(isset($this->fileSet))
{
      $fs = FileSet::getByName($this->fileSet);
      $fl = new FileList();
      $fl->filterBySet($fs);
      $fl->sortBy('fsDisplayOrder', 'desc');
      $fl->sortByFileSetDisplayOrder();
      $files = $fl->get();
}


Any ideas?

 
hostco replied on at Permalink Reply
hostco
Hi,

This looks like you need to increase PHP memory on your server.
intheloft replied on at Permalink Reply
It's set at 128Mb at the moment, I doubled it to 256Mb and it just times out and displays a blank white page after ages of waiting for it to load. So I set it back to 128Mb

I've got another block installed that fetches files from filesets and that works, I don't think it's the server.

By the way, I'm not doing anything fancy with the files just yet, just literally printing the array out.

---- EDIT

OK, that's weird when I call print_r($files); in view.php, this is what causes the error.
But if I do a foreach loop on the file array and echo $file->getRelativePath() it works.

What's the deal with the $files = $fl->get(); array that would cause print_r($files) to run out of memory?
Not that it matters now, I guess I fixed it but just out of curiosity.