Continuous memory allocation with TClonesArray

Dear rooters,
I am using TClonesArray to pass objects from one computer to another over the network. Thus, I am using Streamer. Because of performance reasons I need to avoid it.

Is it possible to have my objects in a continuous block of memory? I would like to have the same behavior as with C++ vectors. First reserve maximum possible memory usage (like vector.reserve()) and then pass this block of memory to another computer with something like memcp function.

With TClonesArray one allocates continuous block of memory for pointers. Can we have the same behavior for the objects? May be not TClonesArray?

Best,
Kostya

Hi,

to transfer objects between processes (and between machines) you need to stream the objects to a buffer. The streaming is needed as objects as such cannot be used in another address space (different virt pointer table). This is also why it does not work to store objects in shared memory and use them from another process. Easiest is just to use a simple TObjArray and stream that via a TMessage to another process.

Cheers, Fons.

Thanks for the help!