Bug #63629


Bug #63692: Memory consumption while bulk inserting

High memory consumption in BackendUtility::getPagesTSconfig while using the DataHandler

Added by Lukas Krieger over 9 years ago. Updated almost 6 years ago.

Must have
Target version:
Start date:
Due date:
% Done:


Estimated time:
TYPO3 Version:
PHP Version:
Is Regression:
Sprint Focus:


There is a memory consumption problem in


In the Typo3 Forum there is this thread, describing the investigation, a solution for a patch and also testing the patch compared to the original function.

Executive Summary:
If you import pages with the DataHandler into Typo3, the function mentioned above is creating a huge array saving all TSconfigs for every page ( line 1197)

if ($useCacheForCurrentPageId) {
> $pagesTSconfig_cache[$id] = $TSconfig;

In my case, there are a lot of different keys in that array but only one unique page TS.

On a normal Backend call, the function is caching the pageTS config for only one page. What makes sense because the function is called multiple times BUT only for
one single page!
Therefore the array has everytime a count of 1.
1 pageID => 1 TSconfig

The main problem is that multiple pages can have the same TSconfig, like in my DataHandler import.
Therefore it would be nice to have a n:n relation for caching the TSconfig in this function.
The static cache array


is in the very first request always empty.

Here is the description of a possible patch:

What the patch currently does is following:
1. add a second static array for caching unique TSconfig
2. use the pagesTSconfig_cache as a reference to the unique TSconfig stored in the other array

Here you can find some tests: (comparing the original function with the patched one and adding conditions in the backend)

An improvement would be maybe to use the CacheManager for storing the caches globally.
Because the parsed page TSconfig is already cached by "TYPO3\\CMS\\Backend\\Configuration\\TsConfigParser" on line 1186

// Parsing the page TS-Config
$pageTS = implode(LF . '[GLOBAL]' . LF, $TSdataArray);
/* @var $parseObj \TYPO3\CMS\Backend\Configuration\TsConfigParser */
$parseObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Configuration\\TsConfigParser');
$res = $parseObj->parseTSconfig($pageTS, 'PAGES', $id, $rootLine);

Some result:

Task: modifying 280 pages
Original Function: The whole process needs 19 seconds and is using 85MB memory
Modified Function: The whole process needs also 19 seconds but is only using 14MB memory

Task: modifying 150 pages
Original Function: 9 seconds, 51.1 MB memory
Modified Function: 8.7 seconds, 11MB memory

Task: modifying 118 pages
Original Function: 7.2 seconds, 41.7 MB memory
Modified Function: 6.8 seconds, 10 MB memory

Task: modifying 54 pages
Original Function: 3.6 seconds , 23MB
Modified Function: 3.3 seconds, 8.5 MB memory

The patch will follow on gerrit.

ps.: there are also some mass editing functions in the normal typo3 backend available. This patch could improve the performance if the backend mass editing is also calling this function.

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #53370: Cache getPagesTSconfig per ID and rootlineClosedJigal van Hemert2013-11-06

Related to TYPO3 Core - Task #82473: Make use of TYPO3s runtime caches instead of static in-method variablesClosed2017-09-13


Also available in: Atom PDF