
Models 707B and 708B Switching Matrix Reference Manual
Section 6: Instrument programming
707B-901-01 Rev. B / January 2015
6-43
•
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-26) 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 of optimizing a channel pattern that consists of five channels.
Example
String concatenation lines
Optimized with the table.concat function
testPattern = "1A03"
testPattern = testPattern .. ",1B03"
testPattern = testPattern .. ",1C03"
testPattern = testPattern .. ",1D03"
testPattern = testPattern .. ",1E03"
print(testPattern)
testTable = { }
testTable[1] = "1A03,"
testTable[2] = "1B03,"
testTable[3] = "1C03,"
testTable[4] = "1D03,"
testTable[5] = "1E03"
testPattern = table.concat(testTable)
print(testPattern)
The output is:
1A03,1B03,1C03,1D03,1E03
The output is:
1A03,1B03,1C03,1D03,1E03
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.