English 中文(简体)
实验室的记忆泄漏与GC无关?
原标题:Memory leakage in php unrelated to GC?

我有一张带有图像、处理图像、然后书写新形象的网址。 I m 采用imagick/imagemagick with php5.3.8 和快乐。 在阅读了我的想法后,垃圾收集功能可能有所帮助,但仓促阻止了在塔克的记忆使用,从增长到三倍。 我在玩弄这一文字。

<?php
var_dump(gc_enabled()); // true
var_dump(gc_collect_cycles()); // number comes out to 0
?>

不知道需要做些什么。 到目前为止,唯一有助于控制营地的物品是每小时或每小时提供一次服务(php-fpm)。 是否利用神灵作为共享的财富,而不是静态地汇编成一体? 任何建议或见解都受到高度赞赏。

最佳回答

两种选择:

  • Farm out the work through gearman or the like to a script that will die completely. Generally I ll run my workers through a certain number of jobs, then have them die. They ll be restarted by supervisor in my setup so it s not a problem. The death after N requests just avoids memory issues.
  • As of 5.4 this might help: http://ca3.php.net/manual/en/function.apache-child-terminate.php

外部图书馆的建筑说明。 我在图像魔.的这个方面玩.,但我与GD看到。 当你重新使用外部图书馆时,你的记忆价值大大降低,但实际记忆的使用几乎相同。

问题回答

检查记忆泄露的良好开端是平常的。

如果PHP拥有大量可用记忆,那么它就会 t灭记忆,因为它不认为需要。 由于它更多地使用,或者如果其他应用开始使用更多的记忆,那么它将清楚知道它能够做些什么。

你们可以通过把记忆交给全国扫盲委员会来使记忆变成一个变数,但建议不定,因为你没有必要强迫它使用较少的记忆,因为购买力平价将自行清理。

But otherwise, a snippet of your code is required to answer your question.





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签