|
more than 1,000 charts in PHP ... |
Posted by Rhaone on Nov-28-2014 02:26 |
|
Dear friends ... after I create more than 1,000 charts in PHP the httpd.exe (Apache)
aborts ...
I have used "unset" but does not work ...
Could anyone help me? ...
Grateful ...
Rhaone |
Re: more than 1,000 charts in PHP ... |
Posted by Peter Kwan on Nov-28-2014 23:45 |
|
Hi Rhaone,
Do you mean you are creating 1000 charts in a single instance of the PHP script? For
example, is it that your PHP script has a loop that creates 1000 charts?
ChartDirector for PHP is designed to automatically free all resources at the end of the
script. Because a PHP script is usually used to service a web request and should return a
limited number of charts and completed in a short time, so this normally would not cause
any memory issues.
However, if your PHP script is long running and creates a large number of charts, you may
call "$garbageCollector();" to ask ChartDirector to immediately release all charts that have
been created in the web page. An example is like:
for ($j=0;$j<1000;$j++) {
$c = new XYChart(......);
....
#output the chart to a file
$c->makeChart(.....);
#the chart is no longer needed at this stage, so release it
$garbageCollector();
}
Hope this can help.
Regards
Peter Kwan |
Re: more than 1,000 charts in PHP ... |
Posted by Rhaone on Nov-29-2014 12:04 |
|
Through your help I found the solution after many attempts ...
We have in 'phpchartdir.php' this ...
...
class XYChart extends BaseChart {
function XYChart($width, $height, ...
...
...
class BaseChart {
function __del__() {
callmethod("BaseChart.destroy", $this->ptr);
}
...
In my code I use the function '__del__ ()' from 'BaseChart' class after the chart
creation ...
...
$ x = $ c -> makeChart ("my_graphic.png");
$ x = $ c -> __del__ ();
...
This way I can make over 3,000 graphics without aborting the httpd.exe ...
I am very grateful to you ...
Rhaone |
|