Creating an Appropriate Memory Buffer
- Updated2025-02-17
- 2 minute(s) read
The Buffer Size input of the TraceTool Start Trace VI sets the size of the memory buffer that stores VI and thread events. The TraceTool Start Trace VI allocates a memory space for the buffer the first time you run the VI. The TraceTool Start Trace VI reuses the same memory space for the memory buffer in subsequent iterations. The Actual Buffer Size output of the TraceTool Start Trace VI returns the actual size of the memory buffer if the real-time operating system cannot allocate the requested Buffer Size.
You must create an appropriately sized memory buffer to capture all event data. Buffer size might be the reason why some VIs listed in the VI view do not appear in the trace session. When the buffer fills, the TraceTool Start Trace VI overwrites the least recent event data with the most recent event data.
If you reach the memory buffer limit, the TraceTool Start Trace VI overwrites the oldest data in the buffer. Therefore, the trace session always contains the latest event data. You can use the following techniques to improve the efficiency of the memory buffer.
- Increase the size of the memory buffer—The default size of the memory buffer is 250 KB. You can use the Buffer Size input of the TraceTool Start Trace VI to set the size of the memory buffer equal to the largest contiguous block of memory available on the RT target.
- Disable unused events—Use the Detailed Tracing?, Thread Tracing?, and VI Tracing? inputs on the TraceTool Start Trace VI to disable unnecessary events and preserve memory in the buffer.
To ensure that data was not overwritten, use the Zoom Extents tool from the Real-Time Trace Viewer toolbar to display the entire trace session. The TraceTool Start Trace VI is always the first VI event logged to the memory buffer. If the memory buffer reaches the buffer size limit, the buffer overwrites the oldest events. If the TraceTool Start Trace VI is the first event that appears in the trace session, the memory buffer did not overwrite any events.