Why is RBuf is not called HBuf though allocated on heap ?
| Tue, 2008-07-15 11:45 | |
|
Hi , While trying to find the answer to my question-"If RBuf is something like a modifiable descriptor which is allocated on heap or someting like HBuf, why it is called RBuf ?" - I came across following lines from a document from Symbian Ltd. 1)RBuf descriptors can live on the stack, but maintain a pointer to memory in the heap. On the stack, they take up 8 bytes more than an HBufC* (i.e. 3 words rather than 1), but will generally take up 4 bytes less heap space (if not constructed from an existing BufC). Now, will somebody help me understand what "On the stack, they take up 8 bytes more than an HBufC* (i.e. 3 words rather than 1), but will generally take up 4 bytes less heap space (if not constructed from an existing BufC) means in a simple manner." Next, will you tell me what "not themselves directly created on the heap" means and how they are allocated. Thanks and Regards, |
|






Forum posts: 85
I think it refers to the fact that the RBuf object, being an R-class, is normally created on the stack, but some of its member variables are allocated on the heap. E.g.:
RBuf8 myBuf; // "myBuf" allocated on the stackmyBuf.Create(10); // member variables in myBuf allocated on the heap
Forum posts: 159
You answered your own question by highlighting the reason in bold.
If somebody asked why is RFs not called HFs because when you use the file system some memory must be being allocated what would be the response? Which is also the answer to your 2nd question. Read about R object to understand about RBuf.