I just ran valgrind from this quick tutorial I Google'd:
Code:
valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --track-fds=yes ./Project\ Two\ V3
And I got all this output, but it doesn't tell me what line to go to.
Code:
==18994== Invalid write of size 4
==18994== at 0x402E985: memmove (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==18994== by 0x804DF91: Process** std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<Process*>(Process* const*, Process* const*, Process**) (in /home/murshed/Dropbox/School Work/Operating Systems/Memory Management Project/Murshed/Project Two V3)
==18994== by 0x804DCC4: Process** std::__copy_move_a<false, Process**, Process**>(Process**, Process**, Process**) (in /home/murshed/Dropbox/School Work/Operating Systems/Memory Management Project/Murshed/Project Two V3)
==18994== by 0x804D71A: __gnu_cxx::__normal_iterator<Process**, std::vector<Process*, std::allocator<Process*> > > std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<Process**, std::vector<Process*, std::allocator<Process*> > >, __gnu_cxx::__normal_iterator<Process**, std::vector<Process*, std::allocator<Process*> > > >(__gnu_cxx::__normal_iterator<Process**, std::vector<Process*, std::allocator<Process*> > >, __gnu_cxx::__normal_iterator<Process**, std::vector<Process*, std::allocator<Process*> > >, __gnu_cxx::__normal_iterator<Process**, std::vector<Process*, std::allocator<Process*> > >) (in /home/murshed/Dropbox/School Work/Operating Systems/Memory Management Project/Murshed/Project Two V3)
==18994== by 0x804CB6E: __gnu_cxx::__normal_iterator<Process**, std::vector<Process*, std::allocator<Process*> > > std::copy<__gnu_cxx::__normal_iterator<Process**, std::vector<Process*, std::allocator<Process*> > >, __gnu_cxx::__normal_iterator<Process**, std::vector<Process*, std::allocator<Process*> > > >(__gnu_cxx::__normal_iterator<Process**, std::vector<Process*, std::allocator<Process*> > >, __gnu_cxx::__normal_iterator<Process**, std::vector<Process*, std::allocator<Process*> > >, __gnu_cxx::__normal_iterator<Process**, std::vector<Process*, std::allocator<Process*> > >) (in /home/murshed/Dropbox/School Work/Operating Systems/Memory Management Project/Murshed/Project Two V3)
==18994== by 0x804B73F: std::vector<Process*, std::allocator<Process*> >::erase(__gnu_cxx::__normal_iterator<Process**, std::vector<Process*, std::allocator<Process*> > >) (in /home/murshed/Dropbox/School Work/Operating Systems/Memory Management Project/Murshed/Project Two V3)
==18994== by 0x804A7C1: main (in /home/murshed/Dropbox/School Work/Operating Systems/Memory Management Project/Murshed/Project Two V3)
==18994== Address 0x432c3ec is 4 bytes before a block of size 16 alloc'd
==18994== at 0x402B9B4: operator new(unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==18994== by 0x804DC59: __gnu_cxx::new_allocator<Process*>::allocate(unsigned int, void const*) (in /home/murshed/Dropbox/School Work/Operating Systems/Memory Management Project/Murshed/Project Two V3)
==18994== by 0x804D671: std::_Vector_base<Process*, std::allocator<Process*> >::_M_allocate(unsigned int) (in /home/murshed/Dropbox/School Work/Operating Systems/Memory Management Project/Murshed/Project Two V3)
==18994== by 0x804C8A2: std::vector<Process*, std::allocator<Process*> >::_M_insert_aux(__gnu_cxx::__normal_iterator<Process**, std::vector<Process*, std::allocator<Process*> > >, Process* const&) (in /home/murshed/Dropbox/School Work/Operating Systems/Memory Management Project/Murshed/Project Two V3)
==18994== by 0x804B598: std::vector<Process*, std::allocator<Process*> >::push_back(Process* const&) (in /home/murshed/Dropbox/School Work/Operating Systems/Memory Management Project/Murshed/Project Two V3)
==18994== by 0x8049C58: main (in /home/murshed/Dropbox/School Work/Operating Systems/Memory Management Project/Murshed/Project Two V3)
==18994==
And the summary
Code:
==18994==
==18994== FILE DESCRIPTORS: 3 open at exit.
==18994== Open file descriptor 2: /dev/pts/0
==18994== <inherited from parent>
==18994==
==18994== Open file descriptor 1: /dev/pts/0
==18994== <inherited from parent>
==18994==
==18994== Open file descriptor 0: /dev/pts/0
==18994== <inherited from parent>
==18994==
==18994==
==18994== HEAP SUMMARY:
==18994== in use at exit: 0 bytes in 0 blocks
==18994== total heap usage: 87 allocs, 87 frees, 19,158 bytes allocated
==18994==
==18994== All heap blocks were freed -- no leaks are possible
==18994==
==18994== For counts of detected and suppressed errors, rerun with: -v
==18994== ERROR SUMMARY: 3 errors from 1 contexts (suppressed: 0 from 0)
Bookmarks