Project Home
Project Home
Source Code
Source Code
File Releases
File Releases
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - valgrind crash in 6.6 in std::vector: (2 Items)
   
valgrind crash in 6.6 in std::vector  
Hi,
Running valgrind for QNX6.6. In my application std::vector are used in c++ application. The valgrind always crash in std
::vector push_back function. The application release and debug version always crash if I run using valgrind. The same 
application no crash without valgrind if I run in release/debug mode. 

Couldn't able to find out what could be the reason for the application crashes in std::vector push_back() using valgrind
.

Below are the valgrind logs stripped. Attached the stack backtrace of crash 

--00:00:00:00.000 39178275-- Valgrind options:
--00:00:00:00.000 39178275--    --tool=memcheck
--00:00:00:00.000 39178275--    -v
--00:00:00:00.000 39178275--    --time-stamp=yes
--00:00:00:00.000 39178275--    --log-file=/var/valgrind/report/tkmain_g_memcheck.log.092419.090119
--00:00:00:00.000 39178275--    --extra-debuginfo-path=/lib
--00:00:00:00.000 39178275--    --allow-mismatched-debuginfo=yes
--00:00:00:00.000 39178275--    --track-origins=yes
--00:00:00:00.000 39178275-- Contents of /proc/version:
--00:00:00:00.000 39178275--   can't open /proc/version
--00:00:00:00.000 39178275-- Arch and hwcaps: X86, LittleEndian, x86-mmxext-sse1-sse2-lzcnt
--00:00:00:00.000 39178275-- Page sizes: currently 4096, max supported 4096
--00:00:00:00.000 39178275-- Valgrind library directory: /usr/lib/valgrind

.....................

--00:00:00:02.686 39178275-- REDIR: 0x159d7a0 (libcpp.so.5:operator new(unsigned int)) redirected to 0xc97c7 (operator 
new(unsigned int))
==00:00:00:05.955 39178275== Invalid read of size 1
==00:00:00:05.955 39178275==    at 0xCA6E1: strlcpy (vg_replace_strmem.c:578 in /usr/lib/valgrind/vgpreload_memcheck-x86
-nto.so)
==00:00:00:05.956 39178275==    by 0x8051F8F: int* std::_Uninit_move<int, int, int>(int*, int*, int*, std::_Wrap_alloc<
std::allocator<int> >&, int*, std::_Scalar_ptr_iterator_tag) (xmemory:486 in /var/debug/TUKMainApp_g)
==00:00:00:05.956 39178275==    by 0x8051EEC: int* std::_Uninit_move<int*, int*, std::_Wrap_alloc<std::allocator<int> > >(int*, int*, int*, std::_Wrap_alloc<std::
allocator<int> >&) (xmemory:513 in /var/debug/TUKMainApp_g)
==00:00:00:05.956 39178275==    by 0x8051DD4: int* std::_Uninitialized_move<int*, int*, std::_Wrap_alloc<std::allocator<int> > >(int*, int*, int*, std::_Wrap_alloc<std::allocator<
int> >&) (xmemory:524 in /var/debug/TUKMainApp_g)
==00:00:00:05.956 39178275==    by 0x8051C88: int* std::vector<int, std::allocator<int> >::_Umove<int*>(int*, int*, int*) (vector:1863 in /var/debug/TUKMainApp_g)
==00:00:00:05.956 39178275==    by 0x80514AC: std::vector<int, std::allocator<int> >::_Reallocate(unsigned int) (vector:
1806 in /var/debug/TUKMainApp_g)
==00:00:00:05.956 39178275==    by 0x8050A20: std::vector<int, std::allocator<int> >::_Reserve(unsigned int) (vector:
1832 in /var/debug/TUKMainApp_g)
==00:00:00:05.956 39178275==    by 0x804FDFF: std::vector<int, std::allocator<int> >::push_back(int&&) (vector:1012 in /var/debug/TUKMainApp_g)
==00:00:00:05.956 39178275==    by 0x804DD6E: main (TUKMainApp.cpp:149 in /var/debug/TUKMainApp_g)
==00:00:00:05.956 39178275==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==00:00:00:05.956 39178275== 
==00:00:00:05.956 39178275== 
==00:00:00:05.956 39178275== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==00:00:00:05.956 39178275==  Access not within mapped region at address 0x0
==00:00:00:05.956 39178275==    at 0xCA6E1: strlcpy (vg_replace_strmem.c:578 in /usr/lib/valgrind/vgpreload_memcheck-x86-nto.so)
==00:00:00:05.956 39178275==    by 0x8051F8F: int* std::_Uninit_move<int, int, int>(int*,
 int*, int*, std::_Wrap_alloc<std::allocator<int> >&, int*, std::_Scalar_ptr_iterator_tag) (xmemory:486 in /var/debug/TUKMainApp_g)
==00:00:00:05.956 39178275==    by 0x8051EEC: int* std::_Uninit_move<int*,...
View Full Message
Attachment: Image stacktrace.JPG 176.7 KB
Re: valgrind crash in 6.6 in std::vector  
Able to run same application successfully(without crash) in valgrind using  callgrind and cachegrind as tool options. 
The problem is the application crash if I use memcheck as passed in tool options or no options in valgrind. 

The same application using valgrind ran successfully in QNX 6.5 for memcheck tools.