[TYPO3-mvc] findOneBy memory usage

Sebastian Fischer typo3 at evoweb.de
Wed Jul 18 09:18:37 CEST 2012


Hi Saverio,

i cant explain why it happens but i can explain the when.

You described that it happens after you hit the result with the getFirst 
method. Thats quite correct because until then the real result was not 
taken from the db. So until you use getFirst no real model and nothing 
from the persistence is taken into account beside that a query_result 
object was created.

Hope that explains why all is fine until you get the item.

Greetings
Sebastian

Am 18.07.2012 02:28, schrieb Saverio Vigni:
> Hello everyone i have a problem with the findOneBy
>
> I'm making a simple web spider for checking the link structure of a
> quite big vacation rental website, everything goes fine until I check in
> the link table if the link I found in the page already exists, actually
> I'm using the code:
>
> $newPage = $this->pageRepository->findOneByUrl($link->getUrl());
> if(!$newPage){
>      $newPage =
> $this->objectManager->create('Tx_Webspider_Domain_Model_Page');
>      $newPage->setUrl($link->getUrl());
>      $this->pageRepository->add($newPage);
> }
>
> this is inside the loop of the links found in the page I'm processing,
> the cal to the findOneBy makes the memory usage grow from 48MB to
> hundreds of megabytes.
>
> I tried rewriting the function and the problem happens when I try to
> access the result of the query with the getFirst() method.
> I haven't been able to understand if the leak is in my code or in
> extbase, can anybody help me?
>
> Thank you
> Saverio Vigni
> http://www.hor-net.com




More information about the TYPO3-project-typo3v4mvc mailing list