LinkedListQueue.heap

Malloc allocation manager, to allocate and deallocate items in queue. We use the malloc allocation manager as to keep the linked list away from the reach of the GC, for efficiency reasons. The reason for this is: The GC collector scans the memory in order to identify the root objects, and then collect them. The scanning process, roughly speaking, is done in such a way that each time the GC detects a new address it runs another scan. On the entire memory. After each scan the amount of detected addresses is increased until there are mo more undetected addresses, and the scanning stops. The problem with linked list is that the GC will detect a single item in each scan. So GC will run as many scans as the number of items in the linked list. And again, each scan goes over the entire memory.

class LinkedListQueue(T, alias gc_tracking_policy = GCTrackingPolicy.refTypesOnly)
protected
Container.Malloc!(QueueItem) heap;

Meta