List limits
List limits
- Subject: List limits
- From: Paul Berkowitz <email@hidden>
- Date: Sun, 16 Dec 2001 18:21:27 -0800
A user of one of my scripts hit an error:
"It seemed like something was happening, although it was taking a long time.
Finally, I switched to the applet and found an error message: "Variable
contactList is not defined". When I clicked on the "Edit" button, I got an
error about text insertion not working because the length limit would be
exceeded. That appeared to involve appending info from some contact to some
variable...I'm not sure."
What sort of limits are associated with lists? Are the memory limits
calculable? I always add items to lists by 'set end of ls to someItem' which
I believe is meant to be the most memory-efficient way. The list in this
case was a list of lists (probably about 20 records), each list consisting
of almost 50 values, mostly short strings with a few dates and application
constants. Unfortunately, this 'contact' class does not have a 'properties'
property, so each of its 50 properties has to be got by a separate Apple
event although I get all of them "at once" in these lists, which maybe adds
to the strain. At the same time the script was "carrying" three more lists
of lists, one of which had some items with very long strings, perhaps
reaching the 32K-per-variable limit. Or is this 32K-per-variable limit only
when writing to a file, and is it even still valid in OS 9 and X?
Presumably coercing these long lists to text (which I did not do in this
case) and setting a variable to it breaks this 32K limit. (As I say, I
didn't do that this time, but frequently do in other scripts.) Would the
best technique for handling large sets of data be to coerce each separate
interior list (one record, basically) to text and write it to a file as it
is extracted, never making these large lists at all? Or is this needlessly
cautious? Is it clear what limit was being transgressed with the error
reported to me?
--
Paul Berkowitz