diff --git a/std/StringBuf.hx b/std/StringBuf.hx index 6cbc140f533..2eda6ba0f2d 100644 --- a/std/StringBuf.hx +++ b/std/StringBuf.hx @@ -89,9 +89,12 @@ class StringBuf { } /** - Removes all characters from `this` StringBuf, making it possible to reuse it. + Visibly removes all characters from `this` StringBuf, making it possible to reuse it. - It will always allocate less memory than constructing a new `StringBuf` instance. + Implementation detail: On some targets, where `this` StringBuf manages an internal buffer, + that buffer MAY not be reallocated on `clear`, preserving its capacity. + This is done to avoid unnecessary allocations on later `add` operations, + but might be incorrectly perceived as a memory leak. **/ public inline function clear():Void { b = "";