G
G
Graid2013-12-20 19:22:15
symfony
Graid, 2013-12-20 19:22:15

How to find Doctrine 2 memory leak?

There is a script in which the data is chased around the cycle, there is a lot of data, but they themselves are quite light. The script looks something like this

$manager->getConnection()->getConfiguration()->setSQLLogger(null);
foreach($projects as $project) {
    $objs = $project->getObjs();
    foreach($objs as $obj) {
        $manager->persist($newObj);
    }
    $manager->flush();
    $manager->clear();
    gc_collect_cycles();
}

Xdebug generates multi-gigabyte reports that are unreadable. The whole RAM is eaten up ~ 8GB. Please help me locate the leak =(

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Confl1kt, 2013-12-20
@Confl1kt

$manager->flush($newObj) - will go through 1 object in UnityOfWork, not all and look for changes
as a result $manager->clear() - not needed, like the garbage collector

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question