kofi_kari_kari
kofi_kari_kari

Reputation: 450

Symfony2 form with big collection

I'm building a form involving a collection of different object. Basically, I give a date of beginning and a date of end, then javascript generates many time the data prototype and hence, I can have a huge amount of line generated.

I understand that I cannot expect to handle thousands of line but here my program displays an error: memory exhausted when I generate about 40 lines. To be more precise, symfony2 displays a white screen and when I go into the dev.log, I get:

[2014-03-12 14:45:59] emergency.EMERGENCY: Allowed memory size of 33554432 bytes exhausted (tried to allocate 16 bytes) {"type":1,"file":"Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php","line":29} []

This error is triggered when the program reach the line form->createView() whith the 40 entities () after they have been added in my data base.

If I increase the number of entities, symfony2 won't even store them in database. Is there a way, using symfony form logic to avoid those errors or should I look at some other ways of generating the form and the view of this object?

Upvotes: 0

Views: 467

Answers (1)

Crozin
Crozin

Reputation: 44406

Your memory limit is set to 32 MiB, that's very modest limit. Considering the fact, that Symfony itself uses about ~25 MiB of memory in dev environment there's not very much you could do about it.

Icrease your memory limit to some adequate level, 128 - 256 MiB should be fine. To do that, modify memory_limit directive in php.ini file:

memory_limit = 256M

Upvotes: 1

Related Questions