summaryrefslogtreecommitdiff
path: root/src/debug
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2018-05-04 10:40:28 -0700
committerGitHub <noreply@github.com>2018-05-04 10:40:28 -0700
commit37e643696f860094ca3182c87f1375540b9d704e (patch)
tree5a840c7743873ca6c46e64a89487989a95880887 /src/debug
parentfac17ce1413c2d270eb52e958faf5e869bcd33a2 (diff)
downloadcoreclr-37e643696f860094ca3182c87f1375540b9d704e.tar.gz
coreclr-37e643696f860094ca3182c87f1375540b9d704e.tar.bz2
coreclr-37e643696f860094ca3182c87f1375540b9d704e.zip
Fix System.String over-allocation (#17876)
BaseSize for System.String was not set correctly. It caused unnecessary extra 8 bytes to be allocated at the end of strings that had `Length % 4 < 2` on 64-bit platforms. This change makes affected strings proportionally cheaper. For example, `new string('a', 1)` in a long-running loop is 7% faster.
Diffstat (limited to 'src/debug')
-rw-r--r--src/debug/daccess/request.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/debug/daccess/request.cpp b/src/debug/daccess/request.cpp
index 377e008fd4..12864e7b0d 100644
--- a/src/debug/daccess/request.cpp
+++ b/src/debug/daccess/request.cpp
@@ -1475,7 +1475,7 @@ ClrDataAccess::GetObjectStringData(CLRDATA_ADDRESS obj, unsigned int count, __ou
if (count > needed)
count = needed;
- TADDR pszStr = TO_TADDR(obj)+offsetof(StringObject, m_Characters);
+ TADDR pszStr = TO_TADDR(obj)+offsetof(StringObject, m_FirstChar);
hr = m_pTarget->ReadVirtual(pszStr, (PBYTE)stringData, count * sizeof(wchar_t), &needed);
if (SUCCEEDED(hr))