Regis St-Gelais wrote:What are the limits of tSTL resources?
in PilRC 3.0 manual we can read: a limitation of 384 strings apply
If I an right, a string list is limited to 384 strings.
What are the limits for the strings themself?
Is there also a limitation on the number of tSTL resources I can put in my resource file? (other than the resource number from 1 to 10000)
Is there a max size for the resource file?
I cannot give you exact figures, but can tell you about my own experience:
- 80,000 strings - about 2 MB
I'm not sure what Alance (or the PilRC 3.0 manual) is basing those numbers on, but they are not the ones I would provide.
Looking at 'tSTL' resources, we see they they are composed of a prefix string, a 2-byte string count, and then an array of non-prefix strings. I found this out by looking at the Palm OS 3.0 source code, but if you don't have that, I'm sure there are other sources (such as the PilRC source code, if not any documentation that PalmSource provides). Given that the number of strings is stored in a 2-byte field, I wouldn't expect to be able to store more than 64K strings in a single resource.
However, there are other factors that would force the actual limit to be much lower. For example, there is a 64K byte limit on the size of a resource that HotSync can handle. So, if you had a collection of strings which had an average length of 15 bytes, you would only be able to provide 4368 or so in a single 'tSTL' resource.
On top of that, there are other limitations, as discovered and reported by John Marshall[1]. Because of bugs in certain versions of the OS, the 2-byte value specifying the number of strings in the resource is not always read correctly by the SysStringByIndex function. In practice, you may not be able to rely on being able to access any string past the 128th in the resource if you use that function.
As for the maximum size of resource files, the limit is much larger than 2MB. The absolute upper limit is around 4GB. There are probably some factors that force a smaller practical limit (such as HotSync time or storage heap size), but that limit should be larger than 2MB.
-- Keith
[1] See "Possible bug in SysStringByIndex", posted in this forum Wed, 3 Oct 2001 (<http://www.escribe.com/computing/pcpqa/m47838.html>).
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
