How to find memory leak on a C++ custom PLCNext library
What can be the best approach to find memory leak or overrun while running my PLCNext/C++ application ?
Is it possile to use Valgrind for example ?
PLCNext Engineer 2019.06
Thanks
What can be the best approach to find memory leak or overrun while running my PLCNext/C++ application ?
Is it possile to use Valgrind for example ?
PLCNext Engineer 2019.06
Thanks
Comments
Hello,
Sorry for the delay.
I don't think it will be possible to use Valgrind, because (if I understand it correctly) Valgrind is started stand-alone, with your own executable passed in as a parameter. Since PLCnext C++ components are packaged as shared object libraries, I don't think this will work.
I was hoping to ask some of our developers for their tips - they develop the System and Service components that come with the PLC, so they may have some advice - but most of them seem to be on holidays at the moment.
In general, it would be good practice to develop a C++ application for PLCnext in classes and/or libraries that keeps as much code as possible platform-independent, and so testable on a platform that supports Valgrind. If the part of the application that depends on the Automation Runtime Platform is as small as possible, then there is less likelihood of memory leaks in the final PLCnext shared object library.
- Martin.