On 2012-10-01 14:06, Michael Stahl wrote:
Or are you talking about memory management?
The current OUString class allocates a new character buffer for every
mutation, I assume we'd keep that strategy.
you mean if i have some string and then add !a" "b" "c" to it it will
re-allocate 3 times? that is too expensive. there needs to be some
protocol to ensure exclusive ownership of the buffer (which the
OUStringBuffer has automatically) and then whenever it's out of capacity
double the allocation.
Ah, I see, you're talking about OUStringBuffer now, not OUString.
Yes, in that case, I imagine we'd store a boolean flag somewhere in the
structure to indicate that the buffer is read-only.
We could probably steal the high bit of the nCapacity field.
Then, a mutation to OUStringBuffer would cause the data to be copied to
a new, freshly allocated buffer, and then things would proceed as they
do currently.
Disclaimer: http://www.peralex.com/disclaimer.html
Context
Re: OUString is mutable? · Stephan Bergmann
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.