Bug 20085 – memory leaks in std.parallelism

Status
NEW
Severity
major
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Mac OS X
Creation time
2019-07-25T19:12:39Z
Last change time
2024-12-01T16:35:16Z
Assigned to
No Owner
Creator
Ali Ak
Moved to GitHub: phobos#9775 →

Comments

Comment #0 by ali.akhtarzada — 2019-07-25T19:12:39Z
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).
Comment #1 by robert.schadek — 2024-12-01T16:35:16Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/9775 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB