5 python notes, 1 memory limits – Rainbow Electronics GM862-GPS User Manual
Page 96

Easy Script
in Python
80000ST10020a Rev.8 - 01/10/08
Reproduction forbidden without Telit Communications S.p.A. written authorization - All Rights Reserved
page 96 of 100
5 Python notes
5.1 Memory Limits
In order to prevent memory error, in phase of compilation or execution of the script, we advise you to
consider the following limits:
•
allocated memory for each variable
•
number of the variables that can cause RAM overflow.
The memory available on Telit Python modules includes:
• around 2MB of Non Volatile Memory for the user scripts and data
• 1.2 MB RAM reserved for Python engine usage
• 16KB of memory for each variable
In order to give rough idea of the impact of these constrains consult the table below that contains limits
for different types of variables. Please note that these limits are estimated values and should be used
only to give general information in Python script development.
Type of
variable
number of elements
27
example
string
16 000
‘data’
list
4 000
[23,‘data’,‘c’]
tuple
4 000
(23,‘data’,‘c’)
range
4 000
range(3)=[0,1,2,3]
dictionary
worst condition 682
{ 'aaa':1000, 'bbb':1001}
NOTE: each element of list, tuple, range, or dictionary has up to 16KB of memory available.
At each startup the Python task loads a list of:
•
variable names
•
module names
•
methods names
•
strings delimited by “ “ or by ‘ ‘ if not terminated with \r