Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Jakcie_Jin
Beginner
82 Views

How to solve Segmentation fault when running TBB on Linux? How to free this memory?

I originally built my TBB code on Windows and it worked fine. Today I moved my code to Linux system (OpenSUSE).

When I tried to run it, I got Segmentation fault. The TBB version I used is TBB21. I also checked where the probelm occured.
and I found it happened when it got to task::spawn_root_and_wait(tl) becuase I could get the cout information before that line and could not get the cout information after that line; The part of code is put below.


SolverP2 Improve(&inst,&mysolution,StartSolT1,&P1Queue,&P2Queue,&P3Queue,iterControl,exchangeControl,&stopControl );
task_list tl;
P2MainTask& a=*new(task::allocate_root()) P2MainTask(&Improve);
tl.push_back(a);
SolverP2T2 Thread2(&inst,&mysolution,StartSolT2,&P1Queue,&P2Queue,iterControl,exchangeControl,&stopControl );
P2Thread2Task& b=*new(task::allocate_root()) P2Thread2Task(&Thread2);
tl.push_back(b);
SolverP2T3 Thread3(&inst,&mysolution,StartSolT3,&P1Queue,&P3Queue,iterControl,exchangeControl,&stopControl );
P2Thread3Task& c=*new(task::allocate_root()) P2Thread3Task(&Thread3);
tl.push_back(c);
Shaking shakeSol(&inst,&mysolution,StartSolT4,&P4Queue,&stopControl );
ShakingTask& d=*new(task::allocate_root()) ShakingTask(&shakeSol);
tl.push_back(d);
cout<<"task deine finished"< task::spawn_root_and_wait(tl);
cout<<"task start finished"<
Could you tell me how to solve this problem? Thanks. In addition I ran a exampel TBB code on this Linux system. It worked.

In addition, after finish these tasks, how can we release the memory defined by new for resue? Thanks!
0 Kudos
1 Reply
Krishna_R_Intel
Employee
82 Views

Hi,
Thanks for using the forum. Is it possible for you to share your sample code where you observed the problem? I'll try to run it here and report what I find and we can go from there. If in case you want to share code, please e-mail it to NOSPAMkrishna.ramkumar@intel.com (remove NOSPAM).

Best regards,
Krishna
Reply