Skip to content

Small memory leak #17

@Thomas-Sparber

Description

@Thomas-Sparber

First of all: thank you so much for this great piece of software!

I found a small memory leak in the stl version of your library, it is in line 233:

this->threads[i].reset(new std::thread(f));

As you can see, a new thread is created with new but it is never deleted. Valgrind gives me the following message:

==5111== 1,216 bytes in 4 blocks are possibly lost in loss record 1,514 of 1,551
==5111== at 0x4C31B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==5111== by 0x40134A6: allocate_dtv (dl-tls.c:286)
==5111== by 0x40134A6: _dl_allocate_tls (dl-tls.c:530)
==5111== by 0x5293227: allocate_stack (allocatestack.c:627)
==5111== by 0x5293227: pthread_create@@GLIBC_2.2.5 (pthread_create.c:644)
==5111== by 0x5AD4A18: std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_deletestd::thread::_State >, void (*)()) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==5111== by 0x255CB8: std::thread::threadctpl::thread_pool::set_thread(int)::{lambda()#1}&(ctpl::thread_pool::set_thread(int)::{lambda()#1}&) (thread:126)
==5111== by 0x253E17: ctpl::thread_pool::set_thread(int) (ctpl_stl.h:233)
==5111== by 0x2536C5: ctpl::thread_pool::resize(int) (ctpl_stl.h:102)
==5111== by 0x25349A: ctpl::thread_pool::thread_pool(int) (ctpl_stl.h:76)

I don't think that this error is very important and should be fixed ASAP, but I just wanted to let you know :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions