aniket2610 Posted March 12, 2021 Report Share Posted March 12, 2021 Hello, I have simple hello world program with two threads (one with while(1) and one without) with deliberate memory leaks. Aim is to find out leaks with either google profiler / address sanitizer tool (If this works then plan is to move main application which is much bigger). When I try to run with either, code fails after sc_stop(). Another interesting thing is if I build systemc library with --enable-pthreads I don't face this issue. what goes wrong when systemC library is not built with --enable-pthreads ? Error from google profiler: "Info: /OSCI/SystemC: Simulation stopped by user. Thread finding failed with -1 errno=14 Thread finding callback was interrupted or crashed; can't fix this" Error from address sanitizer: "Info: /OSCI/SystemC: Simulation stopped by user. ==27585==LeakSanitizer has encountered a fatal error." Does anyone have tried these tools before ? Any idea about this ? Help is appreciated. Thank you. Quote Link to comment Share on other sites More sharing options...
David Black Posted March 12, 2021 Report Share Posted March 12, 2021 Probably because LeakSanitizer was designed with a proper understanding of pthreads; whereas, the non-pthreads implementation uses Q(uick)Threads (or some variant), which implements some assembly language to play with the processor stack to perform context switching. This confuses most if not all memory analysis programs. Pthreads is more universal but slightly slower than QThreads. Quote Link to comment Share on other sites More sharing options...
Andy Goodrich Posted March 12, 2021 Report Share Posted March 12, 2021 David is correct, another program having issues with Quickthreads is valgrind. With Quickthreads SystemC threads actually all live in a single pthread. When a SystemC thread yields to another one the stack is changed from one piece of storage to another in a discontinuous manner. The stack for that single pthread that SystemC is living ends up being discontinuous. With pthreads enabled each SystemC thread is in its own pthread and those stacks are continuous. David Black 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.