c++ - Valgrind gives an error for nearly everything (Warning: client switching stacks?) -


I am corrupting some way memory because my program crashes at random places without error.

I am compiling with - leak-check = full using valgrind, with -O0 -g , and the first problem It detects that the first line in int main is ()

  Caut < & Lt; "Read the file" & lt; & Lt; Endl;   

with

  == 5089 == Warning: Client switching stack? SP changes: 0x7ff0004f8 - & gt; 0x7feb7de10 to suppress == == 5089, use: --max-stackframe = 4,728,552 or size 0x41E107 8 == 5089 == than writing invalid more == 5089 == Key (Dgn.cpp: 2833) == 5089 = address 0x7feb7de08 thread 1 to pile   

is run with

  == 5089 == size 0x5DE6E10 8 == 5089 == Illegal reading: Std :: basic_ostream & lt; Char, std :: char_traits & lt; Char & gt; & Gt; & Amp; Std :: operator's & lt; & Lt; & Lt; Std :: char_traits & lt; Four & gt; & Gt; (Std :: basic_ostream & LT; char, std :: char_traits & LT; four & gt; & gt; & amp;, four constants *) (/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0. in 18) == 5089 == 0x67AEDE4 by: (libc-start.c: 260) (key below) == 5089 == know 0x7feb7de08 thread 1 stack == 5089 == == 5089 == size 8 == illegal write 5089 on == on 0x5DBF8F2: std :: ios_base :: ios_base () 5089 by 0x5E06BFF) == in (/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18 ==: std: : Basic_ifstream & lt; Four, STD:: char_traits & LT; Four & gt; & Gt; :: basic_ifstream (char const *, std :: _ Ios_Openmode) 5089 == By 0x41E131) in (/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18 ==: main (Dgn.cpp: 2834 ) == 5089 == Address 0x7feb7e1e8 is on the stack of thread 1   

which indicates

  ifstream config_file ("file");   

Almost every row has an error.

What is the reason?

I think I've blown my first stack!

to

Many such error messages such as "invalid reading / writing" like a note: "the address is on the stack of thread 1", the reason is very simple Allocating very large variables - in my case I had a big task, which was in the form of local variables.

Reducing the size fixes the problem.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -