This tutorial describes how to allocate MBufs (for data source components in the Data Plane).
The RMBufChain::Alloc() function allocates the specified amount of memory as a chain of one or several RMBuf objects from the Comms pond. If the pond cannot provide the memory area as a single buffer, the chain contains as many RMBuf s linked together as necessary to fulfil the allocation request.
The following example requests 1,800 bytes to the Comms pond. iAllocator is an RMBufAllocator member of the class implementing this example.
RMBufChain aChain; TInt err = chain.Alloc(1800, iAllocator);
The following example requests 1,200 bytes and specifies a minimum and a maximum size of 1,600 bytes. If there are no available 1,600-byte buffers in the pond then an error is returned.
RMBufChain chain; Tint err = chain.Alloc(1200, 1600, 1600, iAllocator);
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.