
2606B System SourceMeter® Instrument Reference Manual
Section 6: Instrument programming
2606B-901-01 Rev. B / May 2018
6-45
Note that the dedicated reading buffers do not consume memory that is needed by the run-time
environment; do not include them in your memory consumption calculations. Also, reading buffers for
remote nodes consume memory on the remote node, not the local node. You should be sure the total
reading buffer memory for any particular remote node does not exceed 24 MB, but do not include that
amount in your local memory consumption calculations.
The amount of memory used by a sweep configuration is based on the number of source points. The
actual memory consumption can vary greatly depending on the source-measure unit (SMU) settings,
but as a general rule, each source point can be expected to consume at least 24 bytes.
It is possible for the memory used for the run-time environment, sweep configuration and reading
buffers to exceed 24 MB. When this occurs, there is a risk that memory allocation errors will occur
and commands will not be executed as expected.
If the instrument encounters memory allocation errors when the memory used is above 95
percent, the state of the instrument cannot be guaranteed. After attempting to save any
important data, turn off power to the instrument and turn it back on to reset the run-time
environment and return the instrument to a known state. Unsaved scripts and reading buffers
will be lost.
The amount of memory in use can be checked using the
meminfo()
function. The first value
returned by
meminfo()
is the number of kilobytes of memory in use.
If the amount of memory used is over 95 percent, or if you receive out-of-memory errors, you should
reduce the amount of memory that is used.
Some suggestions for increasing the available memory:
•
Turn the instrument off and on. This deletes scripts that have not been saved and reloads only
scripts that have been stored in nonvolatile memory.
•
Remove unneeded scripts from nonvolatile memory. Scripts are loaded from nonvolatile memory
into the run-time environment when the instrument is turned on. See
(on page 6-43).
•
Reduce the number of TSP-Link
®
nodes.
•
Delete unneeded global variables from the run-time environment by setting them to
nil
.
•
Set the source attribute of all scripts to
nil
.
•
Adjust the
collectgarbage()
settings in Lua. See
(on page 6-27)
for more information.
•
Review scripts to optimize their memory usage. In particular, you can see memory gains by
changing string concatenation lines into a Lua table of string entries. You can then use the
table.concat()
function to create the final string concatenation.