-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix memory violation when processing cmd line args in the driver #63
Conversation
This may not fix all the problems, looking further. |
More investigations show that this only happens when you have more than one benchmark arguments. For example, |
OK. So, the problem is these two functions: int &argc() { return _argc; }
char **argv() { return _argv.data(); } What happens is that internal members of A clear indicator of this was the fact that |
@aprokop thanks for the explanation Please add a comment to capture that and add the curly braces you removed from the for-loop back |
Will do. It's funny that the second patch was exactly the right fix for this. |
Co-authored-by: Daniel Arndt <arndtd@ornl.gov>
fa5ef68
to
81b4d21
Compare
This is the guilty code: https://github.com/google/benchmark/blob/f92903cc5338daed898242f22015d8426c065770/src/benchmark.cc#L456-L458 |
Running
I still get a memory leak:
|
@masterleinad You are right, it makes no sense. |
So it seems what actually happens is benchmark overwriting the addresses and they never get deallocated. So, we actually need to store an extra array (or return a copy for values). |
No description provided.