Thursday, May 05, 2005

5. Is there any size limit for a descriptor?

Sort of.

Descriptors can be stored on the stack or heap. The normal limitations apply as for other Symbian OS variables:
  • Stack descriptors should be kept small: a 256 byte limit (128 double-byte characters) is a good guide. See 6. Large stack-based descriptors for more information about how to avoid accidentally wasting stack space through use of Symbian OS descriptor typedefs and stack-based classes which encapsulate large descriptors.
  • Heap descriptors can be much larger, depending on the size of heap memory available. But remember, Symbian OS runs on limited memory devices, so allocating a massive descriptor is always unwise.
But the layout of a descriptor object (described elsewhere) will limit the maximum size of a descriptor to 2^28 bytes (256 MB). Since each UNICODE character = 2 bytes, the maximum length of a descriptor is thus 2^27 characters.

Comments:
In the Symbian OS Guide, they specifies that the maximum length of a descriptor is 2^28, even if it's a unicode string.
Do I make a mistake ?

Great thanks for this blog !
 
This may help explain the anomaly:

http://descriptors.blogspot.com/2005/06/25-what-do-length-maxlength-setlength.html

There is 2^28 bytes available, so for both narrow and unicode strings, the maximum size is 2^28.

But the length of the descriptor, on Symbian OS, is described as the number of characters it will hold. This means that, for narrow strings, the maximum length (number of chars) is 2^28 (=number of bytes). For unicode strings, it is half that, because each unicode char is 2 bytes, hence it's 2^27

Hope that helps, and glad you find the blog useful.

Jo
 
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?

Google
WWW Descriptors FAQ