viMemAlloc
This section contains information specific to the Windows product.
Syntax
viMemAlloc(ViSession vi, ViBusSize size, ViPBusAddress offset);
Description
![]() |
viMemAlloc is implemented for PXI MEMACC resources only. It is not implemented for VXI and VXI-GPIB MEMACC resources. |
![]() |
viMemAlloc and viMemFree are not supported for use with VBA on 64-bit systems. Use viMemAllocEx and viMemFreeEx instead. |
The offset returned for a PXI MEMACC resource is an absolute physical address of a contiguous block of memory which has been allocated by the operating system. The memory block is also locked, meaning it will not be swapped out. A common use for this memory is to do user-mode DMA to or from a PXI device..
Both the high-level memory access functions (viInXX, viOutXX, viMoveXX) and the low-level memory access functions (viMapAddress, viPeekXX, viPokeXX, viUnmapAddress) can be used on MEMACC sessions to access the allocated memory.
Parameters
Name |
Dir |
Type |
Description |
---|---|---|---|
vi |
IN |
ViSession |
Unique logical identifier to a session. |
size |
IN |
ViBusSize |
Specifies the size of the allocation. |
offset |
OUT |
ViPBusAddress |
Returns the offset of the allocated device memory. |
Return Values
Type ViStatus |
This is the function return status. It returns either a completion code or an error code as follows. |
Completion Code |
Description |
---|---|
VI_SUCCESS |
Operation completed successfully. |
Error Code |
Description |
VI_ERROR_ALLOC |
Unable to allocate shared memory block of the requested size. |
VI_ERROR_INV_SESSION |
The given session or object reference is invalid (both are the same value). |
VI_ERROR_INV_SIZE |
Invalid size specified. |
VI_ERROR_MEM_NSHARED |
The device does not export any memory. |
VI_ERROR_NSUP_OPER |
The given vi does not support this operation. |
VI_ERROR_RSRC_LOCKED |
Specified operation could not be performed because the resource identified by vi has been locked for this kind of access. |