我正在开发一个项目,我从API中提取数据(JSON).我遇到的问题是内存正在慢慢增长,直到我遇到可怕的致命错误:
致命错误:允许的内存大小*字节耗尽(试图分配*字节)在C:...在线*
我不认为应该有任何记忆增长.我尝试在循环结束时取消所有内容,但没有区别.所以我的问题是:我做错了吗?这是正常的吗?我该怎么做才能解决这个问题?
<?php
$start = microtime(true);
$time = microtime(true) - $start;
echo "Start: ". memory_get_peak_usage(true) . " | " . memory_get_usage() . "<br/>";
include ('start.php');
include ('connect.php');
set_time_limit(0);
$api_key = 'API-KEY';
$tier = 'Platinum';
$threads = 10; //number of urls called simultaneously
function multiRequest($urls, $start) {
$time = microtime(true) - $start;
echo " start function: ". memory_get_peak_usage(true) . " | " . memory_get_usage() . "<br>";
$nbrURLS = count($urls); // number of urls in array $urls
$ch = array(); // array …Run Code Online (Sandbox Code Playgroud)