Issue Bug Closed

#60494editing gridelement in foreign language exhausts memory on large sites

Martin Schnabel 07/23/14, 12:26 updated 10/02/18, 11:52

Description

I have a site with very many pages. tt_content has about 14000 rows. When editing a gridelement in a foreign language typo3 takes too much memory. I had to set memory_limit to 512M.

With some debugging I found out that the problem is inside TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValue when it is called for $col = ‘tx_gridelements_children’. The array $rParts gets very large because it is filled with all uids of tt_content where tx_gridelements_children is 0. For my site that means about 10000 elements. In the later processing of the uids php runs out of memory.

As a workaground I used the hook inside BackendUtility::getProcessedValue by setting

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['preProcessValue'][] = '&\WV\ImgReloaded\Hooks\GridElementsFix->preProcessValue';

inside ext_tables.php (inside an extension of mine)

The hook sets the field type to flex that no processing by BackendUtility::getProcessedValue will be done:

<?php

namespace WV\ImgReloaded\Hooks;

// Hook done in ext_tables.php

class GridElementsFix {

    public function preProcessValue(&$params, &$ref) {
        if (is_array($params) && array_key_exists('foreign_field', $params) && $params['foreign_field'] == 'tx_gridelements_container') {
            $params['type'] = 'flex';
        }
    }

}

I know the workaround is ugly. I hope someone can find a better fix.

(I had gridelements rev 1824f01414736595970f12f239fa76f4850288b3)

Reviews 2