#Access Violation at this line

37 messages · Page 1 of 1 (latest)

empty ledge
#

long hello = batch_size * M1 * sizeof(long); batch_size = 41, M1 = 3200000

hard palmBOT
#

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.

snow wave
#

@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

empty ledge
#

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

snow wave
#

Is this access violation happening in CPU code or GPU code

empty ledge
#

CPU

#

I posted this question thinking someone who did not know I was using GPU prior would answer it

snow wave
#

Nothing here can cause an access violation in and of itself

empty ledge
#

Out of memory maybe?

snow wave
#

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.

loud spadeBOT
#
How To Use Sanitizers

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

General Advice

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.

GCC 4.8+

-fsanitize=address
-fsanitize=undefined
-fsanitize=thread
-g for debug info

clang 3.1+
MSVC 19.27+ and VS 2019 16.9+

-fsanitize=address
-Zi for debug info

Sample Program
int main(void) {
    int x;
    return x;
} ```
`-fsanitize=memory -g` Output

SUMMARY: MemorySanitizer: use-of-uninitialized-value /tmp/test.cpp:3:5 in main
Exiting
(3:5 is line and column of return)

empty ledge
#

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

snow wave
#

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?

thick thorn
#

I'll be back in 20 mins

#

I'll take a look and help 😄

thick thorn
#

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

empty ledge
#

@thick thorn Is it an issue that Im setting vector to a large number? I have changed from malloc to using new

thick thorn
#

Use a vector of string instead of char**

#

use std::cin or std::fstream for input

empty ledge
#

Yes but why am I having access violation issues?

#

@thick thorn

snow wave
snow wave
#

@empty ledge Can you send the output of address sanitizer

hard palmBOT
#

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.