Skip to content

Commit 4dcbcb9

Browse files
authored
Merge pull request #149 from cspencer51/fix_initialize
Register allocated memory with GC during initialization.
2 parents 9f9b3f5 + 8ee112c commit 4dcbcb9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/containers/openhashset.d

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,9 @@ private:
277277
void initialize(size_t nodeCount)
278278
{
279279
nodes = (cast (Node*) allocator.allocate(nodeCount * Node.sizeof))[0 .. nodeCount];
280-
nodes[] = Node.init;
280+
static if (useGC)
281+
GC.addRange(nodes.ptr, nodes.length * Node.sizeof, typeid(typeof(nodes)));
282+
nodes[] = Node.init;
281283
_length = 0;
282284
}
283285

0 commit comments

Comments
 (0)