It is good practice in any real-time programming environment not to allocate memory in the real-time thread. The solution around it is often to pre-allocate all the memory you will need in the setup()
function. If this is not possible (e.g.: a complicated system which needs more memory than there is available in RAM, but not all at the same time), then dynamic allocation should be requested by the real-time thread, performed in a separate thread and then the real-time thread should be signalled when the allocation has been completed.
If you REALLY-REALLY-REALLY need real-time memory allocation, then you'd either pre-allocate a pool of memory and manage it, or ask Xenomai to do it for you (see here). I'd stay away from using Xenomai's own routines as they would limit your portability, but I would not recommend writing your own memory manager, either. So try to use the solutions above.