Issue Bug Closed

#63676High memory consumption for nonFields in ReferenceIndex->getRelations while bulk inserting

Stephan Großberndt 12/08/14, 16:46 updated 10/02/18, 11:48

Description

For each call of every record to get Relations from with ReferenceIndex->getRelations

public function getRelations($table, $row, $onlyField = '') {
    // Initialize:
    $uid = $row['uid'];
    $nonFields = explode(',', 'uid,perms_userid,perms_groupid,perms_user,perms_group,perms_everybody,pid');

a static list of nonFields is initialized by exploding a string. Using a property instead

protected $nonRelationFields = array(
    'uid', 'perms_userid', 'perms_groupid', 'perms_user', 'perms_group', 'perms_everybody', 'pid'
);

[...]
if (!in_array($field, $this->nonRelationFields) && is_array($GLOBALS['TCA'][$table]['columns'][$field]) && (!$onlyField || $onlyField === $field)) {
reduced for bulk inserting of 6500 records
  • 10MB less ram used
  • 6500 calls less – obvious :-)

Reviews 2