Is there a Queue size limit ?

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
 
A

Alberto Poblacion

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top