Dear all,
I am creating a "lot" of coroutines in my code. When I create more than 32744 coroutines (for this example) the program ends with segmentation fault.
So, I would like to known if there is a limit number for active coroutines?
Code below reproduces this situation:
#include<iostream>
#include<cstdlib>
#include<boost/coroutine/all.hpp>
#include <boost/bind.hpp>
#include <vector>
class MyClass{
public:
boost::coroutines::coroutine<void>::pull_type* startResume;
MyClass() {
startResume = NULL;
}
void resume(){
if(startResume && *(startResume))
(*(startResume))();
}
void doSomething ( boost::coroutines::coroutine< void >::push_type & gbck){
gbck();
return;
}
};
int main(int argc, char** argv){
int max = 10;
if (argc > 1)
max = atoi(argv[1]);
std::vector<MyClass*> myobjects(max);
for(int xx=0; xx < max; xx++){
myobjects[xx] = new MyClass ();
myobjects[xx]->startResume = new boost::coroutines::coroutine<void>::pull_type( boost::bind(&MyClass::doSomething, myobjects[xx], _1) );
}
for(int xx=0; xx < max; xx++)
myobjects[xx]->resume();
}
Thanks in advance for your help,
Jose