I am currently working on this.
This is my main priority, and for the moment I cannot sort it out because my code is optimized to maximum already (almost).
I have now created a debug for this and I can see the memory distribution for the projects created.
I think I can optimize more, but it is a long way.
The solution is to increase memory (64 Mo for the moment), but I would like to optimize instead of doing this.
@Pantelis:
Did you changed your structure for N-M ?
Because your way is weired.
30 FK per tables means that you will have 30 Models instancied every time, and same with your SQL queries !!! Too much joins !
In your structure, create a link table containing 2 FK, pointing to your 2 tables.
In this N-M link table, you can add another field for example to handle the number (1 to 30), if you want to control the maximum quantity of links.
This N-M must be done manualy, but it is not a big deal...
This is a big issue for me, because, yes 2.5 is using more memory, so the projects wich was working before, will may exceed memory now. But if you build your component properly it should pass.
Anyway, if I do not find solution, I will increase memory to allow you to generate.