You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In CPP_Demo project, there is something problem which could cause memory dump as below:
// Create 10 different SigGen signal generator task instances with calibration parameters and dynamic addressing
// The constructor of SigGen will create an instance amd an associated XCP event
SigGen* sigGen[10];
for (int i = 0; i <= 9; i++) {
std::string* s = new std::string("SigGen"); s->append(std::to_string(i+1));
sigGen[i] = new SigGen((char*)s->c_str(), 2000, 100.0-i*5, 0.0, i*M_PI/15.0, 2.0);
}
// Create A2L description for class SigGen, use any instance to do this, function cant be static
sigGen[0]->a2lCreateTypedef();
// Create virtual instances of pMinSigGen and pMaxSigGen
minSigGenEvent = new XcpDynObject("pMinSigGen", SigGen);
maxSigGenEvent = new XcpDynObject("pMaxSigGen", SigGen);
Create virtual instances of pMinSigGen and pMaxSigGen could be done before Create 10 different SigGen signal generator task instances.
It should be like this
// Create virtual instances of pMinSigGen and pMaxSigGen
minSigGenEvent = new XcpDynObject("pMinSigGen", SigGen);
maxSigGenEvent = new XcpDynObject("pMaxSigGen", SigGen);
// Create 10 different SigGen signal generator task instances with calibration parameters and dynamic addressing
// The constructor of SigGen will create an instance amd an associated XCP event
SigGen* sigGen[10];
for (int i = 0; i <= 9; i++) {
std::string* s = new std::string("SigGen"); s->append(std::to_string(i+1));
sigGen[i] = new SigGen((char*)s->c_str(), 2000, 100.0-i*5, 0.0, i*M_PI/15.0, 2.0);
}
// Create A2L description for class SigGen, use any instance to do this, function cant be static
sigGen[0]->a2lCreateTypedef();
The SigGen class will generate a thread which could use minSigGenEvent/maxSigGenEvent(points to objects). In some situations minSigGenEvent/maxSigGenEvent will be initialized before the threads use minSigGenEvent/maxSigGenEvent . But it not always works and cause the memory dump.
Wish it helps.
The text was updated successfully, but these errors were encountered:
In CPP_Demo project, there is something problem which could cause memory dump as below:
Create virtual instances of pMinSigGen and pMaxSigGen could be done before Create 10 different SigGen signal generator task instances.
It should be like this
The SigGen class will generate a thread which could use minSigGenEvent/maxSigGenEvent(points to objects). In some situations minSigGenEvent/maxSigGenEvent will be initialized before the threads use minSigGenEvent/maxSigGenEvent . But it not always works and cause the memory dump.
Wish it helps.
The text was updated successfully, but these errors were encountered: