diff options
author | Roman Shchekin <mrqtros@gmail.com> | 2016-11-10 03:06:40 +0300 |
---|---|---|
committer | Dan Moseley <danmose@microsoft.com> | 2016-11-09 16:06:40 -0800 |
commit | c637c919adcd0c0d7fcd8818810bcb727408fa51 (patch) | |
tree | b7373d43cd93da2946348fc605b3a7b97e65e30a /src/coreclr | |
parent | e76da565c106016d604b95f3bb7eadd24ceaf18a (diff) | |
download | coreclr-c637c919adcd0c0d7fcd8818810bcb727408fa51.tar.gz coreclr-c637c919adcd0c0d7fcd8818810bcb727408fa51.tar.bz2 coreclr-c637c919adcd0c0d7fcd8818810bcb727408fa51.zip |
Memory growth algorithm improvement in coreconsole (#7870)
* Now Append will work properly if strLen is big (for example 3xm_capacity). And value 1.5 is better for memory growth.
* Correct way of calculating 1.5 (without floating point calculation, thanks mikedn)
* After long discussion we decided that simple and aggressive allocation is better for this case
Diffstat (limited to 'src/coreclr')
-rw-r--r-- | src/coreclr/hosts/coreconsole/coreconsole.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/coreclr/hosts/coreconsole/coreconsole.cpp b/src/coreclr/hosts/coreconsole/coreconsole.cpp index 7abc02ab7e..ea4e2e72c5 100644 --- a/src/coreclr/hosts/coreconsole/coreconsole.cpp +++ b/src/coreclr/hosts/coreconsole/coreconsole.cpp @@ -44,7 +44,7 @@ public: m_capacity = m_defaultSize; } if (m_length + strLen + 1 > m_capacity) { - size_t newCapacity = m_capacity * 2; + size_t newCapacity = (m_length + strLen + 1) * 2; wchar_t* newBuffer = new wchar_t[newCapacity]; wcsncpy_s(newBuffer, newCapacity, m_buffer, m_length); delete[] m_buffer; |