开发者

How to debug C++ memory errors?

Does valgrind work with STL allocator? I am using STL vector with plain C library in the follwing fashion:

double some_C_functions(int, double*);

std::vector<double> v;
.....
double result = some_C_functions(v.size(), &v[0]);
开发者_运维知识库

What if the C functions tries to overshoot the pointer? Can valgrind detect the error?


Valgrind should still be able to detect that since it's hooking into the memory management which still goes to the same heap for C or C++. Obviously it's hard(er) to detect errant reads though.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜