Skip to content

Instantly share code, notes, and snippets.

@jameskyle
Created April 6, 2014 05:06
Show Gist options
  • Save jameskyle/10001755 to your computer and use it in GitHub Desktop.
Save jameskyle/10001755 to your computer and use it in GitHub Desktop.
The referenced line of code is inside the async in example.cpp here:
m.lock();
std::cout << "Starting new thread: " << std::this_thread::get_id() << std::endl;
std::cout << "Path: " << entry.path() << std::endl; // example.cpp:37
m.unlock();
----------------
==30211== Thread 4:
==30211== Invalid read of size 1
==30211== at 0x6ED96: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::alloc
ator<char> > const&) (in /usr/lib/libc++.1.dylib)
==30211== by 0x100003D8B: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > boost::filesystem::path::string<std::__1::basic_string<char, std::__1::char_traits<
char>, std::__1::allocator<char> > >() const (path.hpp:720)
==30211== by 0x100001B09: std::__1::basic_ostream<char, std::__1::char_traits<char> >& boost::filesystem::operator<< <char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::c
har_traits<char> >&, boost::filesystem::path const&) (path.hpp:659)
==30211== by 0x10000140D: get_hashes(boost::filesystem::path&, std::__1::vector<std::__1::future<std::__1::pair<unsigned int, boost::filesystem::path> >, std::__1::allocator<std::__1::future<std:
:__1::pair<unsigned int, boost::filesystem::path> > > >&)::$_0::operator()(boost::filesystem::directory_entry const&) const::{lambda()#1}::operator()() const (example.cpp:37)
==30211== by 0x10000131D: _ZNSt3__112__async_funcIZZ10get_hashesRN5boost10filesystem4pathERNS_6vectorINS_6futureINS_4pairIjS3_EEEENS_9allocatorIS9_EEEEENK3$_0clERKNS2_15directory_entryEEUlvE_JEE9
__executeIJEEES8_NS_15__tuple_indicesIJXspT_EEEE (__functional_base:413)
==30211== by 0x1000012FD: _ZNSt3__112__async_funcIZZ10get_hashesRN5boost10filesystem4pathERNS_6vectorINS_6futureINS_4pairIjS3_EEEENS_9allocatorIS9_EEEEENK3$_0clERKNS2_15directory_entryEEUlvE_JEEc
lEv (future:2323)
==30211== by 0x10000170D: _ZNSt3__119__async_assoc_stateINS_4pairIjN5boost10filesystem4pathEEENS_12__async_funcIZZ10get_hashesRS4_RNS_6vectorINS_6futureIS5_EENS_9allocatorISA_EEEEENK3$_0clERKNS3_
15directory_entryEEUlvE_JEEEE9__executeEv (future:962)
==30211== by 0x10000164D: _ZNSt3__114__thread_proxyINS_5tupleIJMNS_19__async_assoc_stateINS_4pairIjN5boost10filesystem4pathEEENS_12__async_funcIZZ10get_hashesRS6_RNS_6vectorINS_6futureIS7_EENS_9a
llocatorISC_EEEEENK3$_0clERKNS5_15directory_entryEEUlvE_JEEEEEFvvEPSN_EEEEEPvSS_ (__functional_base:380)
==30211== by 0x463898: _pthread_body (in /usr/lib/system/libsystem_pthread.dylib)
==30211== by 0x463729: _pthread_start (in /usr/lib/system/libsystem_pthread.dylib)
==30211== by 0x467FC8: thread_start (in /usr/lib/system/libsystem_pthread.dylib)
==30211== Address 0x1000306e0 is 0 bytes inside a block of size 56 free'd
==30211== at 0x722F: free (in /usr/local/Cellar/valgrind/3.9.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==30211== by 0x11DF3: boost::filesystem::detail::directory_iterator_increment(boost::filesystem::directory_iterator&, boost::system::error_code*) (in /usr/local/Cellar/boost/1.55.0_1/lib/libboost
_filesystem.dylib)
==30211== by 0x1000029E5: boost::iterator_facade<boost::filesystem::directory_iterator, boost::filesystem::directory_entry, boost::single_pass_traversal_tag, boost::filesystem::directory_entry&,
long>::operator++() (iterator_facade.hpp:660)
==30211== by 0x100002428: boost::filesystem::detail::recur_dir_itr_imp::increment(boost::system::error_code*) (operations.hpp:807)
==30211== by 0x1000021F4: boost::filesystem::recursive_directory_iterator::increment() (operations.hpp:960)
==30211== by 0x1000021A5: boost::iterator_facade<boost::filesystem::recursive_directory_iterator, boost::filesystem::directory_entry, boost::single_pass_traversal_tag, boost::filesystem::director
y_entry&, long>::operator++() (iterator_facade.hpp:660)
==30211== by 0x100000C0A: get_hashes(boost::filesystem::path&, std::__1::vector<std::__1::future<std::__1::pair<unsigned int, boost::filesystem::path> >, std::__1::allocator<std::__1::future<std:
:__1::pair<unsigned int, boost::filesystem::path> > > >&) (algorithm:833)
==30211== by 0x100000D2F: main (example.cpp:60)
==30211==
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment