Plot Pack Component Memory Usage

Return To Contents

The Plot Pack components include several mechanisms for controlling the amount of RAM memory that is used to store channel data. By storing all or some of the data for each channel, the plot component makes it possible to use the built in scrolling, zooming, and cursor tools to be able to look at historical data and to be able to print and save that data to other formats.

The following sections will discuss how the Plot Pack components store data and how to control the amount of RAM memory that is used to suit your needs.

Data Storage

Memory Usage Calculations

Since the plot pack components are designed to handle asynchronous data channels (i.e. the data points from one channel don't have to be in sync with data points in another channel), each data point use 2 double values and a Boolean value to represent a single data point

2 doubles and a Boolean value are used to represent one data point.

2 Double Values = 20 bytes (double = 10 bytes)

  1. Boolean Value = 4 bytes

Total = 20 + 4 = 24 bytes per data point

Therefore, each data point that you add to the chart takes up 24 bytes of memory. If you expect to add 1 million (1,000,000) data points to your chart, you can expect to use…

24 bytes * 1,000,000 = 24,000,000 bytes

24 million bytes / 1024 bytes per KB = 23,437.5 KB

23,437.5 KB / 1024 KB per MB = 22.89 MB for 1,000,000 Data Points

…a total of 22.89 MB for all 1 million data points. If you have 5 channels with 100,000 data points added to each channel that would be…

24 bytes * 5 channels * 100,000 = 12,000,000 bytes

12 million bytes / 1024 bytes per KB = 11,718.8 KB

11,718.8 KB / 1024 KB per MB = 11.44 MB for 5 channels

…a total of 11.44MB of data storage needed for 5 channels with 100,000 data points each channel.

Future versions of our Plot Pack will include the capability to specify the data storage style where you can trade-off functionality of our component for increased number of allowable points to be stored in the component.

  1. GB Application RAM Barrier

Under the Windows 32-bit operating system, each application is limited to using a total 2GB of RAM Memory (2048 MB). This includes memory usage by everything in the program, including variables in your code and memory used by all components in the application (ActiveX, VCL, or CLX components). Keep this in mind when determining how much data you can fit into the chart as exceeding the 2GB RAM Usage barrier can result in nasty out of memory or other program and system errors. If you run into this issue, then either use the Ring Buffer feature of the Plot Pack, reduce the number of data points added to the chart, or periodically save the data to an external file and clear out the buffer before adding additional data points. Future versions of Windows will support larger memory usage sizes. Consult your development environment documentation and Windows documentation for more information about future updates to this limitation

Under Linux (CLX components only) the amount of memory accessible by an application depends on your kernel version, kernel build, and development environment. This can range between 2GB and 64GB depending on your situation, but is generally a 2GB limit for most distributions. Consult your development environment documentation and Linux distribution documentation for more information.

Ring Buffer

By default, the plot components store all data that has been added to available system RAM memory. To control the amount of memory that is used by the charts, you can take advantage of the Ring Buffer support in the plot components.

The Ring Buffer is a FIFO (First In First Out. In other words, when the buffer is full, the first data point added is the first data point to be overwritten) type buffer where you specify the maximum amount of data points that can fit in the buffer. Once that maximum number is exceeded, then data is removed from the buffer starting with the first data points that were initially added.

Notice! When you set the Ring Buffer to a non-zero value, then memory will be allocated for that number of data points whether or not those data points actually exist. The advantage to this type of buffer is that you will always know if the buffer you have set exceeds the available RAM + Virtual Memory on your system ahead of time, instead of find this out after running the chart overnight!

To enable the Ring Buffer for a particular channel, set the RingBufferSize property for the number of data points that you wish to remain in the buffer for a specific channel.

iPlot1.Channel(0).RingBufferSize = 10000

To disable the ring buffer and storage all data to available memory (up to the 2GB per application limit), set the ring buffer property to zero…

iPlot1.Channel(0).RingBufferSize = 0

IOCO0063.gif

Contents | Index | Previous | Next