I am learning how to use cppcheck. I am confused about the library configuration. How do I find out what functions and what configuration should be added? If this is not set, does it mean it cannot do memory leak check? Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If this is not set, does it mean it cannot do memory leak check?
new/delete (C++) does always work and std.cfg is always loaded, so malloc/free should always work, too. However, in libraries also other functions can be specified to tell cppcheck that they have no impact on allocated memory (<leak-ignore/>), which increases the accuracy of results. Custom allocation functions need to be specified in libraries, otherwise cppcheck is not able to detects leaks when using them.
How do I find out what functions and what configuration should be added?
--check-library gives you a hint.
Last edit: Mr. X 2016-06-03
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am learning how to use cppcheck. I am confused about the library configuration. How do I find out what functions and what configuration should be added? If this is not set, does it mean it cannot do memory leak check? Thanks.
new/delete (C++) does always work and std.cfg is always loaded, so malloc/free should always work, too. However, in libraries also other functions can be specified to tell cppcheck that they have no impact on allocated memory (<leak-ignore/>), which increases the accuracy of results. Custom allocation functions need to be specified in libraries, otherwise cppcheck is not able to detects leaks when using them.
--check-library gives you a hint.
Last edit: Mr. X 2016-06-03