Section 6: Instrument programming
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 runtime
environment and return the instrument to a known state. Unsaved scripts and data in 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 runtime environment when the instrument is turned on. See
instrument
•
Reduce the number of TSP-Link
•
Delete unneeded global variables from the runtime environment by setting them to nil.
•
Set the source attribute of all scripts to nil.
•
Adjust the collectgarbage() settings in Lua. See
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.
6-54
Model 2651A High Power System SourceMeter® Instrument Reference Manual
(on page 6-52).
®
nodes.
Delete user scripts from the
Lua memory management
2651A-901-01 Rev. C October 2021
(on page 6-31)
Need help?
Do you have a question about the Keithley 2651A and is the answer not in the manual?
Questions and answers