Appendix C:
DADiSP Memory Usage


DADiSP requires system memory to perform calculations. DADiSP uses double precision floating point values, so, each data point in a DADiSP series is 8 bytes. A buffer is kept in memory for each series in the Worksheet. The default maximum buffer size allocated per series is 32768 points or 32768 * 8 = 262144 bytes. For many applications, this buffer size is suitable. However, if you want to customize memory utilization, or if you receive "NO MEMORY" messages from DADiSP, you may want to modify your buffer size.


DADiSP uses virtual signal management. This means that when the series length exceeds the maximum buffer size, DADiSP automatically pages the series to disk. That is, DADiSP transparently uses the disk as memory for the series. If the series length is less than the maximum buffer size, the buffer is automatically reduced to the proper size and no disk access is required.


DADiSP employs just in time memory management, where the optimal buffer size is determined prior to the actual calculation. Again, if the optimal buffer size is found to be larger than the maximum buffer size, the maximum size is allocated. By setting the maximum buffer size, you can control how DADiSP allocates memory for large series.


The maximum buffer size is configurable via the SETBUFSIZE function or the BUFSIZE parameter in the DADISP.CNF file. There is a correlation between the speed of calculations and the memory usage when configuring BUFSIZE.


Setting BUFSIZE to be small, for example setbufsize(512), means that DADiSP will keep 512 points of each series in memory (512 * 8 bytes), and page the remainder of the series to disk, thus possibly slowing down large series calculations.


Setting BUFSIZE to be large, i.e. setbufsize(131072), will keep 131072 points of each series in memory; if, while performing a calculation, you have so much data in that DADiSP cannot allocate BUFSIZE for all series in the Worksheet, you might receive a NO MEMORY message.


The default value for BUFSIZE is 32768. If you have modified the BUFSIZE parameter in the DADISP.CNF file, DADiSP will begin each session with the buffer size set to the value of BUFSIZE.


To determine size of the buffer, type: setbufsize at the command line in a Worksheet. The value returned at the bottom of the screen is the current setting of BUFSIZE. If you are running out of memory or if you are working with many series with few data points, you should decrease the value of BUFSIZE.


Tables and multi-column data take up more memory in DADiSP than single series windows because a DADiSP table or matrix is a list of series, i.e. each column is a series. Each column has a sample rate, units, and other information associated with it, in addition to the actual data, that are stored in memory. The length of the columns can be as large as you need because DADiSP will page the data part of the series to disk. The amount of memory required for a table is a function of the number of columns (BUFSIZE * NUMCOLS plus the memory required for the "overhead info" for each column).


Another aspect of the DADiSP Worksheet which can use up memory temporarily is the ability to reference the CURRENT window (or W0) in the window formula. For example: ravel(curr,fft(w1)). To allow a window formula to reference its corresponding window, DADiSP makes a copy in memory of the data in the current window (just in case the window formula references it). After DADiSP executes the window formula, it replaces the data in the window and frees up the memory allocated to the previous version of the window data.


However, if you know that your window formula does not reference CURR, for example: FFT(w1), there is no reason for DADiSP to keep a copy of that data because it uses up memory, especially if the data in the window is a large matrix.


The CLEARDATA function can clear the copy of CURR before executing the rest of the window formula. Include this in the beginning of the window formula to eliminate unnecessary memory usage. For example: