[Boost-users] [Interprocess] message queue Cannot Allocate Memory

81 views
Skip to first unread message

cons_Pavignani, Antonio

unread,
Dec 7, 2012, 6:34:21 AM12/7/12
to boost...@lists.boost.org
Dear all,

I use the message queue. I create a queue inside a thread (called Thread A)  and I use it in another thread (called Thread B).
I get this error:  Cannot Allocate memory.

This is the code related to the Thread A:

    message_queue::remove(InterprocessQueueName.c_str());
    message_queue     mq(open_or_create,InterprocessQueueName.c_str(),MAX_INTERPROCESS_SEND_QUEUE_SIZE,CalculatingSizeStructure::maxSizeHMIExtMessage);

     for(;;)
    {
        try
        {
            unsigned int priority;
            std::size_t recvd_size;

            mq.receive(msgBuffer, CalculatingSizeStructure::maxSizeHMIExtMessage, recvd_size, priority);

...
}
catch (interprocess_exception &ex)
{
...
}
}

This is the code related to the Thread B:

            boost::interprocess::message_queue *mq = InterprocessQueueManager::getInstance()->openQueue("Library_Queue");
                if((mq->try_send(&msgCmdSendStatusToLibraryInfoR,sizeof(LibraryInfo),0))==false)
                {...
                }


I've looked for that exception, and  it seems to be related to the POSIX queue. I've also tried some solutions without results.

Any ideas?

Thanks in advance,

Best Regards

Antonio

Ion Gaztañaga

unread,
Dec 8, 2012, 4:24:32 PM12/8/12
to boost...@lists.boost.org
El 07/12/2012 12:34, cons_Pavignani, Antonio escribió:

> I've looked for that exception, and it seems to be related to the POSIX
> queue. I've also tried some solutions without results.

Interprocess msg queue does not use posix queues. The queue is mapped on
shared memory, maybe the size your are requesting might be too big.
You'll need to track the code with the debugger to see where exactly the
exception is thrown.

Best,

Ion
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply all
Reply to author
Forward
0 new messages