1

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?

2
  • Please tell us what `some_C_functions1 does Commented Sep 9, 2011 at 14:46
  • Read or writing on the overshoot though.... :) Commented Sep 9, 2011 at 15:08

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.