The maximum practical size is as much stack as you currently have available. (a few KB)
The maximum size you should use is... not big at all...
I would never use a TBuf allocated on stack that is more then maybe 256 bytes.
In fact, I hardly ever use them, would only consider using them if I felt they would help battle heap fragmentation.
Be aware though that the TBuf will only be on stack if you declare it as an automatic variable in a function.
If you put it as a member in a class, it will be allocated wherever your class is (which for C-classes are on the heap if you follow the convention)
I'd recommend you take a look at RBuf instead of both TBuf and HBufC, its a lot more flexible and easy to use then both of them, and always allocate storage for the data in heap.
@Alh you are wrong, the maximum theoretical descriptor size is about 256 MB. This is because descriptor length is written as TInt32 value but 4 bits of this value defines descriptor type, so descriptor size use remaining 28 bits 2^28 = 268435456B = (about) 256MB
Forum posts: 1232
The maximum theoretical size is about 2 GB.
The maximum practical size is as much stack as you currently have available. (a few KB)
The maximum size you should use is... not big at all...
I would never use a TBuf allocated on stack that is more then maybe 256 bytes.
In fact, I hardly ever use them, would only consider using them if I felt they would help battle heap fragmentation.
Be aware though that the TBuf will only be on stack if you declare it as an automatic variable in a function.
If you put it as a member in a class, it will be allocated wherever your class is (which for C-classes are on the heap if you follow the convention)
I'd recommend you take a look at RBuf instead of both TBuf and HBufC, its a lot more flexible and easy to use then both of them, and always allocate storage for the data in heap.
Forum posts: 49
@Alh you are wrong, the maximum theoretical descriptor size is about 256 MB. This is because descriptor length is written as TInt32 value but 4 bits of this value defines descriptor type, so descriptor size use remaining 28 bits 2^28 = 268435456B = (about) 256MB