I tried to implement multithreading in php to fetch data from a data source parallely.
But in the process, the threads i create to fetch the data continue to remain in the memory, even after the fetching.
This is the class that i call
class ClassName extends Thread {
public function __construct($i){
$this->i=$i;
}
public function run(){
// functionCallToDataSource($this->i);
}
}
and i call this class here (in a loop).
$workers = new ClassName(parameter);
$workers->start();
$workers->kill(); //this isnt working
This kill() doesnt seem to work for me, as the memory is not reduced after the functions have been performed. I have to restart my server to free the blocked memory