#Access Violation at this line
37 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For more information use !howto ask.
@empty ledge Nowhere near enough context 😉
If this is CPU, use address sanitizer
If it's GPU, use cuda memcheck
Make sure you aren't compiling with optimizations on
Hi @snow wave please provide more context. I have not used address sanitizer. I am using visual studio, how do I use address sanitizer in visual studio.
Why do I need to use address sanitizer? These are all the questions I have
Is this access violation happening in CPU code or GPU code
CPU
I posted this question thinking someone who did not know I was using GPU prior would answer it
Nothing here can cause an access violation in and of itself
Out of memory maybe?
On CPUs the primary suspect might be a stack overflow. On GPU there are more pitfalls. Alternatively, maybe the debugger is mis-reporting the line.
Sanitizers are tools which generate additional code in your program that can catch many common programming mistakes, such as:
• accessing arrays out of bounds
• signed integer overflows
• race conditions
Not all sanitizers can be combined, but when they can, use e.g.:
-fsanitize=address,undefined to combine them. Always compile with debug info to get line numbers, variable names, etc.
• -fsanitize=address
• -fsanitize=undefined
• -fsanitize=thread
• -g for debug info
• -fsanitize=address
• -fsanitize=undefined
• -fsanitize=thread
• -fsanitize=memory
• -g for debug info
• -fsanitize=address
• -Zi for debug info
int main(void) {
int x;
return x;
} ```
SUMMARY: MemorySanitizer: use-of-uninitialized-value /tmp/test.cpp:3:5 in main
Exiting
(3:5is line and column ofreturn)
Do you see anything which would cause a stack overflow?
I am not inspired to use more tools, they will just mean more questions.
Hi @snow wave I will have to post a new question as I havent been able to get enough support here
I’m going to sleep and can’t download attachments on mobile
Someone will take a look, just be patient
@thick thorn want to take a look?
I'm at a hospital with my father
I'll be back in 20 mins
I'll take a look and help 😄
Lot's of potential of memory issues in that code
* no sanitation of fscanf_s input
* might be passing 0 to new[]
* sprintf
from a quick look
@thick thorn Is it an issue that Im setting vector to a large number? I have changed from malloc to using new
Nah, its ok, if you want a static container (if you know "the number" at compile time) , use std::array
Use a vector of string instead of char**
use std::cin or std::fstream for input
Oh shoot hope all is ok 😟
@empty ledge Can you send the output of address sanitizer
This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.