Is there a Queue size limit ?

  • Thread starter Thread starter Jia Lu
  • Start date Start date
J

Jia Lu

Hi all

I'm using Queue like "Queue logQ = new Queue();", I didnot pass a
parameter to set the size of the queue.
Is there a size limit when I do this ? I mean is there a default size
of queue instances.
Is queue overflow considerable ?

Thanks .

Jia Lu
 
Jia Lu said:
I'm using Queue like "Queue logQ = new Queue();", I didnot pass a
parameter to set the size of the queue.
Is there a size limit when I do this ? I mean is there a default size
of queue instances.
Is queue overflow considerable ?

I presume that you refer to System.Collections.Queue.

The queue will automatically grow when it runs out of space. The default
growth factor is 2.0, meaning that the queue will double in capacity when
its current size is exhausted. The documentation specifies the following:

"The growth factor is the number by which the current capacity is multiplied
when a greater capacity is required. The growth factor is determined when
the Queue is constructed. The default growth factor is 2.0. The capacity of
the Queue will always increase by at least a minimum of four, regardless of
the growth factor. For example, a Queue with a growth factor of 1.0 will
always increase in capacity by four when a greater capacity is required."

Therefore, an overflow is not to be expected, unless you insert so many
items in the queue that you exhaust your available memory.
 
Back
Top