SEGGER_SYSVIEW_HeapAlloc() function
SEGGER_SYSVIEW_HeapAlloc() Function description Record a system-heap allocation event. Parameters pHeap - Pointer to heap where allocation was made. pUserData - Pointer to allocated user data. UserDataLen - Size of block allocated to hold user data, excluding any metadata. Additional information The user data must be correctly aligned for the architecture, which typically requires that the alignment is at least the alignment of a double or a long long. pUserData is, therefore, compressed by shrinking as IDs are compressed, controlled by the specific setting of SEGGER_SYSVIEW_ID_SHIFT. In the same way, UserDataLen must reflect the size of the allocated block, not the allocation size requested by the application. This size is also subject to compression, controlled by the specific setting of SEGGER_SYSVIEW_ID_SHIFT. As an example, assume the allocator is running on a Cortex-M device with SEGGER_SYSVIEW_ID_SHIFT set to 2 (the word alignment of the device). If a user requests an allocation of 5 bytes, a hypothetical heap allocator could allocate a block with size 32 bytes for this. The value of UserDataLen sent to SystemView for recording should be 32, not 5, and the 32 is compressed by shifting by two bits, the configured value of SEGGER_SYSVIEW_ID_SHIFT, and describes the number of bytes that are consumed from managed memory from which SystemView can calculate accurate heap metrics.
SEGGER_SYSVIEW_HeapAlloc() calls 4 functions:
![]()
SEGGER_SYSVIEW_HeapAlloc()
SEGGER_SYSVIEW_HeapAlloc() reads 3 variables:
![]()
SEGGER_SYSVIEW_HeapAlloc()