You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/coreclr/src/vm/eventpipebuffer.cpp
+15-2
Original file line number
Diff line number
Diff line change
@@ -23,8 +23,21 @@ EventPipeBuffer::EventPipeBuffer(unsigned int bufferSize, EventPipeThread* pWrit
23
23
m_state = EventPipeBufferState::WRITABLE;
24
24
m_pWriterThread = pWriterThread;
25
25
m_eventSequenceNumber = eventSequenceNumber;
26
-
m_pBuffer = new BYTE[bufferSize];
26
+
// Use ClrVirtualAlloc instead of malloc to allocate buffer to avoid potential internal fragmentation in the native CRT heap.
27
+
// (See https://github.com/dotnet/runtime/pull/35924 and https://github.com/microsoft/ApplicationInsights-dotnet/issues/1678 for more details)
28
+
//
29
+
// This fix does cause a little bit of performance regression (1-2%) in throughput,
30
+
// but within acceptable boundaries, while minimizing the risk of the fix to be backported
31
+
// to servicing releases. We may come back in the future to reassess this and potentially improve
32
+
// the throughput via more performant solution afterwards.
// Make the buffer size fit into with pagesize-aligned block, since ClrVirtualAlloc expects page-aligned sizes to be passed as arguments (see ctor of EventPipeBuffer)
0 commit comments