# Process Data Memory All mapped process data objects of the SubDevices are copied by the MainDevice into a process data memory image. New input values received from the SubDevices are written to the input process data image. New output values to be sent to the SubDevices are read from the output process data image. The EC-Master uses two separate buffers where process data input values and process data output values are stored. The buffers used may either be always the same (fixed buffers) or be changed on every process data transfer cycle (dynamic buffers). The EC-Master has different options for how the process data memory is provided. 1. EC-Master provides process data memory (fixed buffers) 2. User application registers an external memory provider with fixed buffers 3. User application registers an external memory provider with dynamic buffers ## EC-Master as process data memory provider If the application does not register a memory provider, the EC-Master internally allocates the required memory needed to store input and output process data values during [`emConfigureNetwork()`](api_general_functions.html.md#_CPPv418emConfigureNetwork10EC_T_DWORD13EC_T_CNF_TYPE10EC_T_PBYTE10EC_T_DWORD). The EC-Master always uses the same buffers for reading/writing process data. ## Application as process data memory provider with fixed buffers The application may register a memory provider with [emIoCtl - EC_IOCTL_REGISTER_PDMEMORYPROVIDER](api_general_functions.html.md#emioctl-ec-ioctl-register-pdmemoryprovider) in case the EC-Master shall use externally allocated memory to store input and output process data values. The memory provider may optionally supply callback functions to synchronize memory access between the application and the EC-Master. Receiving new input process data: : - [`EC_T_MEMPROV_DESC::pfPDInDataWriteRequest`](api_general_functions.html.md#_CPPv4N17EC_T_MEMPROV_DESC22pfPDInDataWriteRequestE) - [`EC_T_MEMPROV_DESC::pfPDInDataWriteRelease`](api_general_functions.html.md#_CPPv4N17EC_T_MEMPROV_DESC22pfPDInDataWriteReleaseE) Sending new output process data: : - [`EC_T_MEMPROV_DESC::pfPDOutDataReadRequest`](api_general_functions.html.md#_CPPv4N17EC_T_MEMPROV_DESC22pfPDOutDataReadRequestE) - [`EC_T_MEMPROV_DESC::pfPDOutDataReadRelease`](api_general_functions.html.md#_CPPv4N17EC_T_MEMPROV_DESC22pfPDOutDataReadReleaseE) ## Application as process data memory provider with dynamic buffers The application registers an external memory provider without fixed buffers via [emIoCtl - EC_IOCTL_REGISTER_PDMEMORYPROVIDER](api_general_functions.html.md#emioctl-ec-ioctl-register-pdmemoryprovider) with the parameters [`EC_T_MEMPROV_DESC::pbyPDInData`](api_general_functions.html.md#_CPPv4N17EC_T_MEMPROV_DESC11pbyPDInDataE) and [`EC_T_MEMPROV_DESC::pbyPDOutData`](api_general_functions.html.md#_CPPv4N17EC_T_MEMPROV_DESC12pbyPDOutDataE) set to [`EC_NULL`](toc_api.html.md#c.EC_NULL). In this case, the EC-Master requests via the callback functions the buffer addresses cyclically when reading or writing process data. This mode can be used to implement dynamic buffering mechanisms between the application and the EC-Master, e.g. double buffering, triple buffering.