0
我有一個內存泄漏,只有在我使用OpenMP支持和GNU並行擴展編譯時出現:-fopenmp -DGLIBCXX_PARALLEL
。GNU內存泄漏並行擴展
例子:
std::transform(buffer, buffer + _tabLength, _origData, MathUtil::ShortToDouble);
結果(抱歉Valgrind的模板恐怖):
==7109== 912 bytes in 3 blocks are possibly lost in loss record 3 of 4
==7109== at 0x4C29C64: calloc (vg_replace_malloc.c:593)
==7109== by 0x4010F29: allocate_dtv (dl-tls.c:296)
==7109== by 0x401163D: _dl_allocate_tls (dl-tls.c:460)
==7109== by 0x5C505B8: [email protected]@GLIBC_2.2.5 (allocatestack.c:579)
==7109== by 0x582D1C5: ??? (in /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0)
==7109== by 0x4309DB: double (*__gnu_parallel::__for_each_template_random_access_workstealing<__gnu_parallel::_IteratorPair<short*, double*, std::random_access_iterator_tag>, double (*)(short), __gnu_parallel::__transform1_selector<__gnu_parallel::_IteratorPair<short*, double*, std::random_access_iterator_tag> >, __gnu_parallel::_DummyReduct, bool>(__gnu_parallel::_IteratorPair<short*, double*, std::random_access_iterator_tag>, __gnu_parallel::_IteratorPair<short*, double*, std::random_access_iterator_tag>, double (*)(short), __gnu_parallel::__transform1_selector<__gnu_parallel::_IteratorPair<short*, double*, std::random_access_iterator_tag> >&, __gnu_parallel::_DummyReduct, bool, bool&, std::iterator_traits<__gnu_parallel::_IteratorPair<short*, double*, std::random_access_iterator_tag> >::difference_type))(short) (workstealing.h:139)
==7109== by 0x42F6C8: double (*__gnu_parallel::__for_each_template_random_access<__gnu_parallel::_IteratorPair<short*, double*, std::random_access_iterator_tag>, double (*)(short), __gnu_parallel::__transform1_selector<__gnu_parallel::_IteratorPair<short*, double*, std::random_access_iterator_tag> >, __gnu_parallel::_DummyReduct, bool>(__gnu_parallel::_IteratorPair<short*, double*, std::random_access_iterator_tag>, __gnu_parallel::_IteratorPair<short*, double*, std::random_access_iterator_tag>, double (*)(short), __gnu_parallel::__transform1_selector<__gnu_parallel::_IteratorPair<short*, double*, std::random_access_iterator_tag> >&, __gnu_parallel::_DummyReduct, bool, bool&, std::iterator_traits<__gnu_parallel::_IteratorPair<short*, double*, std::random_access_iterator_tag> >::difference_type, __gnu_parallel::_Parallelism))(short) (for_each.h:86)
==7109== by 0x42EAF3: double* std::__parallel::__transform1_switch<short*, double*, double (*)(short)>(short*, short*, double*, double (*)(short), std::random_access_iterator_tag, std::random_access_iterator_tag, __gnu_parallel::_Parallelism) (algo.h:1240)
==7109== by 0x42E329: double* std::__parallel::transform<short*, double*, double (*)(short)>(short*, short*, double*, double (*)(short)) (algo.h:1293)
如何解決這個任何想法?
eek。你有沒有像書籍或任何類型的參考解釋這些?我需要解釋爲什麼我的項目報告中存在一些僞泄漏。 順便說一下,我想沒有OpenMP清理功能可能有助於在軟件執行結束時運行? –
查看Jakub Jelinek的解釋[here](http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36298)。請注意兩個報告中的_dl_allocate_tls。 –
非常感謝! –