www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [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:


_D2rt8monitor_13ensureMonitorFNbC6ObjectZPOSQBqQBq7Monitor
(temp:x86_64+0x1001a5dbc)

Direct leak of 48 byte(s) in 3 object(s) allocated from:





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:





SUMMARY: AddressSanitizer: 48 byte(s) leaked in 3 allocation(s).

--
Jul 25 2019