3
我花了最後2個小時試圖找到我的內存泄漏。內存泄漏symfony和monolog和控制檯
- 優化學說批量處理
- 優化我的分離和所有的信條註釋東西
- 優化的SQL記錄儀
- 腳本仍然漏水
- 決定註釋掉記錄,因爲WASN我無論如何都能做
原來,
- 超過40K迭代而無需在各登錄n,而是在模數50,啓動MEM:28 MB端MEM:30MB
- 超過5K迭代與記錄在每個n,沒有模量,開始MEM:28MB,端MEM 38MB 。
例
# this leaks
# start mem: 28 mb end mem: 38mb, n = 5k
foreach ($this->queryData->iterate() as $j => $data):
declare(ticks = 1);
self::$currentAd++;
$this->em->detach($data[0]);
$this->logger->info(LogUtility::getMemoryUsage() . " (" . self::$currentAd .")");
if(self::$currentAd === 40000):
break(2);
endif;
endforeach;
# this doesn't leak
# start mem: 28 mb end mem: 30mb, n = 40k
foreach ($this->queryData->iterate() as $j => $data):
declare(ticks = 1);
self::$currentAd++;
$this->em->detach($data[0]);
if(self::$currentAd % 50 == 0):
$this->logger->info(LogUtility::getMemoryUsage() . " (" . self::$currentAd .")");
endif;
if(self::$currentAd === 40000):
break(2);
endif;
endforeach;
我的獨白配置:
handlers:
test:
type: stream
path: "%kernel.logs_dir%/immobilier/test.log"
level: debug
channels: test
console:
type: console
bubble: false
verbosity_levels:
VERBOSITY_VERBOSE: INFO
VERBOSITY_VERY_VERBOSE: DEBUG
channels: [test]
任何建議,以糾正呢?