{"comment":{"url":"https://api.github.com/repos/aashikhmin82/test/comments/9673290","html_url":"https://github.com/aashikhmin82/test/commit/da7c2fb8b1258a8bdd37a8668f2e46d9b91eb7f3#commitcomment-9673290","id":9673290,"user":{"login":"sergey-v-galtsev","id":2011871,"avatar_url":"https://avatars.githubusercontent.com/u/2011871?v=3","gravatar_id":"","url":"https://api.github.com/users/sergey-v-galtsev","html_url":"https://github.com/sergey-v-galtsev","followers_url":"https://api.github.com/users/sergey-v-galtsev/followers","following_url":"https://api.github.com/users/sergey-v-galtsev/following{/other_user}","gists_url":"https://api.github.com/users/sergey-v-galtsev/gists{/gist_id}","starred_url":"https://api.github.com/users/sergey-v-galtsev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergey-v-galtsev/subscriptions","organizations_url":"https://api.github.com/users/sergey-v-galtsev/orgs","repos_url":"https://api.github.com/users/sergey-v-galtsev/repos","events_url":"https://api.github.com/users/sergey-v-galtsev/events{/privacy}","received_events_url":"https://api.github.com/users/sergey-v-galtsev/received_events","type":"User","site_admin":false},"position":72,"line":189,"path":"ALGORYTHMS/SORT/insert_alg.cpp","commit_id":"da7c2fb8b1258a8bdd37a8668f2e46d9b91eb7f3","created_at":"2015-02-10T11:39:30Z","updated_at":"2015-02-10T11:39:30Z","body":"valgrind говорит, что тут утекла память.\r\nЧтобы этого не происходило, можно воспользоваться умным указателем:\r\nhttp://ru.cppreference.com/w/cpp/memory/shared_ptr\r\nили для единственных указателей на объект (в C++11)\r\nhttp://ru.cppreference.com/w/cpp/memory/unique_ptr\r\n(В C++ до 2011 для единственных указателей был auto_ptr, но у него очень неестественная семантика. Которая порождала ошибки, например конструкция vector<auto_ptr<...> > работала некорректно.\r\nПоэтому от него отказались и в C++11 пометили как устаревший.)\r\n\r\n==6685== HEAP SUMMARY:\r\n==6685==     in use at exit: 506 bytes in 17 blocks\r\n==6685==   total heap usage: 20,045 allocs, 20,028 frees, 1,249,377 bytes allocated\r\n==6685== \r\n==6685== 506 (24 direct, 482 indirect) bytes in 1 blocks are definitely lost in loss record 17 of 17\r\n==6685==    at 0x4C2B0E0: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)\r\n==6685==    by 0x40176E: main (insert_alg.cpp:189)"}}