Issue Bug Closed

#73032File search causes memory leaks with too many files

Alexander Schnitzler 01/30/16, 14:09 updated 10/17/17, 23:07

Description

During the file search in the file module the search result is only limited to possibly matching folders. That itself decreases the search over all files in a storage but it still does not prevent memory leaks, where the result of possible folders contain a decent amount of files.

Example:
fileadmin has a total of 10.000 files.
fileadmin has a subfolder called foo
fileadmin/foo holds a subset of 1000 files.
fileadmin/foo holds the file bar

A search for bar asks the database for all folders that contain files with the matching identifier bar. As a result, only the folder fileadmin/foo is returned which already excludes 9000 possible files.

Still, the resultset contains 1000 files, whoose name is compared php-wise with the search string. During that foreach loop each a file object with a decent memory footprint will be created. This easily exceeds the avialable memory limit.

Reviews 2