Issue 20085 - memory leaks in std.parallelism
Summary: memory leaks in std.parallelism
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86 Mac OS X
: P2 major
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-25 19:12 UTC by Ali Ak
Modified: 2024-12-01 16:35 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Ali Ak 2019-07-25 19:12:39 UTC
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 dlangBugzillaToGithub 2024-12-01 16:35:16 UTC
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