View Full Version : In-band copy operation

04-17-2004, 01:18 AM

I've read the OpenML spec inside out I think, but I still can't understand what exactly happens during a mlSendControls().
In the spec it says two opposite things, it says on one hand "Enqueueing entails a _copy_ operation, so the application is free to delete/alter the message as soon as the call returns", but on the other hand it says "Notice that the divice performs _no memory allocation_, but rather use the memory allocated when the application enqueued the message".

What is happening here? If I send an MLpv and set pByte to be memory I've allocated, then that memory will be copied, i.e. a new malloc() within the mlSendControls(), will it not?


~ Daniel

04-18-2004, 03:43 PM
It is true that a 'pByte' contained in an MLpv that you send in a mlSendControls() will be copied over (so you can delete your pByte when the function returns).

However, no malloc() is performed: the data is copied over to a pre-allocated memory area (this memory is actually allocated by the device as its 'queue data' storage).

(You can check this out for yourself in the SDK source tree -- see 'mlpublic.c' and 'mlqueue.c' in the oss/lib/ml/common/src directory. You'll also need to look at one of the sample devices, to see its end of things)

04-21-2004, 10:37 AM
Ok, thanks.

~ Daniel