Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes asan's detected tbb leak in osrm-partition
Here's all I could get out of a instrumented `osrm-partition`; debug build, with all the bells and whistles I could think of to make it more verbose: ``` ==17928==ERROR: LeakSanitizer: detected memory leaks Direct leak of 1560 byte(s) in 3 object(s) allocated from: #0 0x7f4244185b30 in operator new[](unsigned long) ../../../../libsanitizer/asan/asan_new_delete.cc:62 #1 0x7f4242a788b3 (/usr/lib/libtbb.so.2+0x208b3) SUMMARY: AddressSanitizer: 1560 byte(s) leaked in 3 allocation(s).<Paste> `` Symbolizing the address results in ``` echo "/usr/lib/libtbb.so 0x7f4242a788b3" | llvm-symbolizer _fini ``` Looks like a crt finalizer => static global dtor "leaking" from tbb. Which turned out to be a missing `tbb::task_scheduler_init` on our end: > Using task_scheduler_init is optional in Intel® Threading Building > Blocks (Intel® TBB) 2.2. By default, Intel TBB 2.2 automatically creates > a task scheduler the first time that a thread uses task scheduling > services and destroys it when the last such thread exits. https://www.threadingbuildingblocks.org/docs/help/hh_goto.htm?index.htm#reference/task_scheduler/task_scheduler_init_cls.html Without an explicit instanz the first call to a tbb algorithm seem to initialize a global scheduler singleton which then "leaks" until the program exits. Phew.
- Loading branch information