Chromium: Substring of string retains string in memory(issues.chromium.org)
issues.chromium.org
Chromium: Substring of string retains string in memory
https://issues.chromium.org/issues/41480525
3 コメント
But having only one reference is rare, often you extract several pieces of data from a huge string.
Unless the underlying storage is reference counted with some small granularity. That might be a way to go, when a substring is taken, split the original and keep track of the pieces separately.
Unless the underlying storage is reference counted with some small granularity. That might be a way to go, when a substring is taken, split the original and keep track of the pieces separately.
Twelve years and running!
I assume the underlying storage isn't reference counted, because if it was it seems it would be trivial to detect there's only a single reference left, and trigger a reallocation.
[1]: https://gcc.gnu.org/wiki/FloatingPointMath