July 25, 2019 [Issue 20085] New: memory leaks in std.parallelism | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20085 Issue ID: 20085 Summary: memory leaks in std.parallelism Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Severity: major Priority: P1 Component: phobos Assignee: nobody@puremagic.com Reporter: ali.akhtarzada@gmail.com Almost every single example in the doc page (https://dlang.org/phobos/std_parallelism.html) leaks memory, usually something like: ================================================================= ==73260==ERROR: LeakSanitizer: detected memory leaks Direct leak of 288 byte(s) in 3 object(s) allocated from: #0 0x10df204b7 in wrap_calloc (libldc_rt.asan.dylib:x86_64+0x5f4b7) #1 0x10ce4bdbc in _D2rt8monitor_13ensureMonitorFNbC6ObjectZPOSQBqQBq7Monitor (temp:x86_64+0x1001a5dbc) Direct leak of 48 byte(s) in 3 object(s) allocated from: #0 0x10df1ff73 in wrap_malloc (libldc_rt.asan.dylib:x86_64+0x5ef73) #1 0x10ce4cfca in _D2rt5tlsgc4initFNbNiZPv (temp:x86_64+0x1001a6fca) #2 0x7fff61c4f248 in _pthread_start (libsystem_pthread.dylib:x86_64+0x6248) #3 0x7fff61c4b40c in thread_start (libsystem_pthread.dylib:x86_64+0x240c) SUMMARY: AddressSanitizer: 336 byte(s) leaked in 6 allocation(s). Here's a simple program: import std; void main() { auto t = new TaskPool(3); t.finish(true); } Run it with: ldc2 -fsanitize=address -g -disable-fp-elim -frame-pointer=all temp.d && ASAN_OPTIONS=detect_stack_use_after_return=1:detect_leaks=1 ./temp Output: ================================================================= ==73394==ERROR: LeakSanitizer: detected memory leaks Direct leak of 48 byte(s) in 3 object(s) allocated from: #0 0x105aecf73 in wrap_malloc (libldc_rt.asan.dylib:x86_64+0x5ef73) #1 0x10566d47a in _D2rt5tlsgc4initFNbNiZPv (temp:x86_64+0x10019c47a) #2 0x7fff61c4f248 in _pthread_start (libsystem_pthread.dylib:x86_64+0x6248) #3 0x7fff61c4b40c in thread_start (libsystem_pthread.dylib:x86_64+0x240c) SUMMARY: AddressSanitizer: 48 byte(s) leaked in 3 allocation(s). -- |
Copyright © 1999-2021 by the D Language Foundation