If i try to export large amounts of data with JMSSerializerBundle
i get the following error.
FatalErrorException: Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1332351 bytes) in /var/www/app/trunk/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php line 27
If i export only few records with this bundle, everything works fine.
$format = 'json';
$serializer = \JMS\Serializer\SerializerBuilder::create()->build();
$serializer->serialize($data, $format, SerializationContext::create()->enableMaxDepthChecks());
The count of array $data
is 1917
How can i handle this issue?
Try to do somewhere in your script a:
echo ini_get('memory_limit'); // To see how much memory you have
And then update the memory_limit settings in the php.ini file. Restart the server and try it again.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments