を漏らす: http://symfony.com/doc/2.7/cookbook/testing/doctrine.html私たちは、このテストを書かれている:symfonyのとPHPUnitのメモリはsymfonyのドキュメンテーションの出発当社PHPUnitテストで</p> <p>を教義をロードするときに私たちは、メモリリークの問題を持っている
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
class memoryleakTest extends KernelTestCase
{
private $em;
protected function setUp()
{
self::bootKernel();
$this->em = static::$kernel->getContainer()
->get('doctrine')
->getManager();
}
protected function tearDown()
{
parent::tearDown();
$this->em->close();
}
function testEEE1() {
}
function testEEE2() {
}
function testEEE3() {
}
function testEEE4() {
}
function testEEE5() {
}
function testEEE6() {
}
function testEEE7() {
}
function testEEE8() {
}
function testEEE9() {
}
function testEEE10() {
}
function testEEE11() {
}
function testEEE12() {
}
function testEEE13() {
}
function testEEE14() {
}
function testEEE15() {
}
function testEEE16() {
}
}
我々はこの結果を得ました(括弧の間php_memory_usage):私たちは、セットアップでの教義マネージャの負荷を削除した場合、我々が得た
testEEE1: . (42M)
testEEE2: . (42.7M)
testEEE3: . (43.3M)
testEEE4: . (44M)
testEEE5: . (44.8M)
testEEE6: . (45.5M)
testEEE7: . (46.1M)
testEEE8: . (46.8M)
testEEE9: . (47.4M)
testEEE10: . (48.1M)
testEEE11: . (48.7M)
testEEE12: . (49.4M)
testEEE13: . (50.1M)
testEEE14: . (50.7M)
testEEE15: . (51.4M)
testEEE16: . (52M)
(32,7M )各テストのために
ティアダウン機能で各テストの後にドクトリンをアンロードするのは適切な方法ですか?
は私によく見えます。とにかくカールがありますか?それは私に致命的なメモリリークを引き起こしました – DevDonkey
@DevDonkeyテストではまったく何もありません。カールもDBアクセスもありません。それを使用せずにdoctrineを呼び出すだけです(おそらくすべてのメタデータを読み込みます)。メモリにロードされたすべての情報は、カーネル - > shutdown()でも解放されていないようです。 – Cedric