Memory Considerations For The Runtime Environment - Keithley 708B Reference Manual

Switching matrix
Hide thumbs Also See for 708B:
Table of Contents

Advertisement

Section 6: Instrument programming

Memory considerations for the runtime environment

The runtime environment has a fixed amount of memory for storing user scripts, channel patterns,
and other runtime information.
You can check the amount of memory in the instrument with the memory.used() and
memory.available() functions. These functions return the percentage of memory that is used or
available. When you send this command, memory used or available is returned as a comma-delimited
string with percentages for used memory.
The format is systemMemory, scriptMemory, patternMemory, where:
systemMemory: The percentage of memory used or available in the instrument.
scriptMemory: The percentage of memory used or available in the instrument to store user
scripts.
For example, if you send the command:
MemUsed = memory.used()
print(MemUsed)
You will get back a value such as 69.14, 0.16, 12.74, where 69.14 is the percentage of
memory used in the instrument, 0.16 is the percentage used for script storage, and 12.74 is the
percentage used for channel pattern storage.
See memory.available() (on page 7-135) and memory.used() (on page 7-137) for more detail
on using these functions.
If the amount of memory used is over 95%, 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
(on page 6-43).
Reduce the number of TSP-Link nodes.
Delete unneeded channel patterns (this affects only pattern memory, not instrument memory). See
Channel patterns
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
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. The example below shows an example of optimizing a
channel pattern that consists of five channels.
6-44
Models 707B and 708B Switching Matrix Reference Manual
(on page 2-99).
Delete user scripts from the instrument
Lua memory management
707B-901-01 Rev. A / August 2010
(on page 6-31) for

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

707b

Table of Contents