Skip to content

Commit

Permalink
Avoid GC Allocations in sharedStaticDtor
Browse files Browse the repository at this point in the history
The `Thread.opApply` static method will use `realloc` from `core.stdc.stdlib` instead of `gc.gc.GC.malloc` which sometimes fails with `onInvalidMemoryOperationError` when run within a `static ~this` module dtor
  • Loading branch information
Etienne Cimon committed Oct 4, 2016
1 parent e3f842d commit 856c984
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions std/parallelism.d
Original file line number Diff line number Diff line change
Expand Up @@ -976,9 +976,7 @@ private final class ParallelismThread : Thread
// Kill daemon threads.
shared static ~this()
{
auto allThreads = Thread.getAll();

foreach (thread; allThreads)
foreach (ref thread; Thread)
{
auto pthread = cast(ParallelismThread) thread;
if (pthread is null) continue;
Expand Down

0 comments on commit 856c984

Please sign in to comment.