Series 3700A System Switch/Multimeter Reference Manual
Section 10: Instrument programming
3700AS-901-01 Rev. D/June 2018
10-51
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 10-49).
•
Reduce the number of TSP-Link
®
nodes.
•
Delete unneeded channel patterns (this affects only pattern memory, not instrument memory).
See
(on page 5-19).
•
Delete unneeded DMM configurations (this affects only configuration memory, not instrument
memory. See
(on page 4-7).
•
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 10-30)
for 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.
The example below shows an example that optimizes a channel pattern that consists of five
channels.
Example
String concatenation lines
Optimized with the table.concat function
ch1 = "" .. 5 * 1000 + 15 .. ","
ch2 = "" .. 5 * 1000 + 25 .. ","
ch3 = "" .. 5 * 1000 + 35 .. ","
ch4 = "" .. 5 * 1000 + 915 .. ","
ch5 = "" .. 5 * 1000 + 925
testPattern = ch1 .. ch2 .. ch3 .. ch4 .. ch5
print(testPattern)
testTable = { }
testTable[1] = "5015,"
testTable[2] = "5025,"
testTable[3] = "5035,"
testTable[4] = "5915,"
testTable[5] = "5925"
testPattern =
table.concat(testTable)
print(testPattern)
The output is:
5015,5025,5035,5915,5925
The output is:
5015,5025,5035,5915,5925
If the instrument encounters memory allocation errors when memory used is above 95
percent, the state of the instrument cannot be guaranteed. After attempting to save any
important data, it is recommended that you turn off power to the instrument and turn it back
on to return the instrument to a known state. Cycling power resets the run-time environment.
Unsaved scripts and channel patterns will be lost.