Allocation of Message queues

I am using the mqueue implementation for creating queues in my app. I would like to know where and when is the memory used for queues allocated.
For ex if i create a queue of 1000 num of msg and each msg of 1024 bytes ,where and when will this much memory allocated? on ram or on disk.


Always in ram.

I ran a sample pgm in which i created queues of different sizes and checked the memory allocation thru showmem -P. However,in each instance i saw the same amountof memory being allocated on heap,stack etc .So where does exactly this memory go?and where can i view the meory allocation for queues.Does it get allocated in my application process address space or mqueue space ?

mqueue allocates memory in it’s own space.
mq allocates memory in the kernel’s space.