This topic describes memory management in the Communications Framework.
The Communications Framework preallocates memory area buffers to increase the performance of its Data Plane. When a Comms Data Plane component needs a buffer, it asks for one from its pond. The pond contains pools of buffers : each pool contains buffers of a different size, and all the buffers in a pool have the same size. If the pond doesn't have a big enough buffer, it will string together a chain of smaller buffers to meet the request.
The Communications Framework uses shared buffers. The Data Plane has strong performance requirements, and using shared buffers helps to avoid the memory copy that occurs between the kernel memory context and the Communications stack.
A Comms buffer, or MBuf, is a contiguous memory area used to store data on the Data Plane. It is represented by an RMBuf object, which combines a shared buffer with metadata. See Shared buffers and Comms Buffers (MBuf) and Comms Chains .
A Comms buffer chain links together one or more Comms buffers. This decreases memory consumption because there is no need to reserve space for temporary large buffers, which can be created from a chain of smaller buffers. The chain is represented by a RMBufChain object. For more information, see Comms Buffers (MBuf) and Comms Chains .
Pre-allocated collection of shared buffers. See Shared buffers .
The buffers of a pool all have the same size. Depending on the amount of used buffers, the pool dynamically grows and shrinks by a set number of buffers, which reduces the frequency of expensive memory allocation and reduces memory usage when possible.
The pond is a collection of pools. It is an RCommsBufPond object which keeps track of the memory available in the pools and allocates all the Comms buffer chains by taking buffers from the appropriate pools.
The memory provided by the pond is available to all the layers of the Comms Framework as well as to the drivers underneath the lower layer. Therefore, the Comms Framework components and the drivers can exchange data without additional memory copies.
At the moment, there is only one pond in the Comms Framework.
For more information, see Advanced Pond Guide .
Depending on where your component is in the Data Plane, you handle Comms buffers in a different way:
Protocol plugins manipulate the data plane flow represented by buffer chains. They obtain a buffer chain from another layer (up or down), process the chain, and send the chain to the next layer in the stack. Link layer components belong to that category.
See Data Access Example .
Data source components, either at the top or at the bottom of the Comms Framework, create buffer chains and send them through the Data Plane. Device drivers belong to that category.
In order to increase performance and decrease memory consumption with Comms buffers, you need to configure the pond according to your memory usage. For more information, see Advanced Pond Guide and Pond Configuration Reference .
To monitor the pond and its available memory, see Memory Metrics .
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.