http://trac.webkit.org/changeset/137328
https://bugs.webkit.org/show_bug.cgi?id=109367
causes memory usage to balloon if connection queue is filling
faster than sending (Requested by kling on #webkit).
Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2013-02-09
* Platform/CoreIPC/ArgumentEncoder.cpp:
(CoreIPC::ArgumentEncoder::ArgumentEncoder):
(CoreIPC::ArgumentEncoder::grow):
* Platform/CoreIPC/ArgumentEncoder.h:
(CoreIPC::ArgumentEncoder::buffer):
(ArgumentEncoder):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@142384
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2013-02-09 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r137328.
+ http://trac.webkit.org/changeset/137328
+ https://bugs.webkit.org/show_bug.cgi?id=109367
+
+ causes memory usage to balloon if connection queue is filling
+ faster than sending (Requested by kling on #webkit).
+
+ * Platform/CoreIPC/ArgumentEncoder.cpp:
+ (CoreIPC::ArgumentEncoder::ArgumentEncoder):
+ (CoreIPC::ArgumentEncoder::grow):
+ * Platform/CoreIPC/ArgumentEncoder.h:
+ (CoreIPC::ArgumentEncoder::buffer):
+ (ArgumentEncoder):
+
2013-02-08 Sam Weinig <sam@webkit.org>
Fix ASSERT when the Web Content Process crashes
2013-02-08 Sam Weinig <sam@webkit.org>
Fix ASSERT when the Web Content Process crashes
ArgumentEncoder::ArgumentEncoder()
: m_buffer(0)
ArgumentEncoder::ArgumentEncoder()
: m_buffer(0)
- , m_bufferCapacity(inlineBufferSize)
if (alignedSize + size > m_bufferCapacity) {
size_t newCapacity = std::max(alignedSize + size, std::max(static_cast<size_t>(32), m_bufferCapacity + m_bufferCapacity / 4 + 1));
if (alignedSize + size > m_bufferCapacity) {
size_t newCapacity = std::max(alignedSize + size, std::max(static_cast<size_t>(32), m_bufferCapacity + m_bufferCapacity / 4 + 1));
-
- if (newCapacity > inlineBufferSize) {
- // Use system malloc / realloc instead of fastMalloc due to
- // fastMalloc using MADV_FREE_REUSABLE which doesn't work with
- // mach messages with OOL message and MACH_MSG_VIRTUAL_COPY.
- // System malloc also calls madvise(MADV_FREE_REUSABLE) but after first
- // checking via madvise(CAN_REUSE) that it will succeed. Should this
- // behavior change we'll need to revisit this.
- if (!m_buffer)
- m_buffer = static_cast<uint8_t*>(malloc(newCapacity));
- else
- m_buffer = static_cast<uint8_t*>(realloc(m_buffer, newCapacity));
-
- if (!m_buffer)
- CRASH();
-
- if (usesInlineBuffer())
- memcpy(m_buffer, m_inlineBuffer, m_bufferCapacity);
- }
+ // Use system malloc / realloc instead of fastMalloc due to
+ // fastMalloc using MADV_FREE_REUSABLE which doesn't work with
+ // mach messages with OOL message and MACH_MSG_VIRTUAL_COPY.
+ // System malloc also calls madvise(MADV_FREE_REUSABLE) but after first
+ // checking via madvise(CAN_REUSE) that it will succeed. Should this
+ // behavior change we'll need to revisit this.
+ if (!m_buffer)
+ m_buffer = static_cast<uint8_t*>(malloc(newCapacity));
+ else
+ m_buffer = static_cast<uint8_t*>(realloc(m_buffer, newCapacity));
+
+ if (!m_buffer)
+ CRASH();
m_bufferCapacity = newCapacity;
}
m_bufferSize = alignedSize + size;
m_bufferCapacity = newCapacity;
}
m_bufferSize = alignedSize + size;
- return buffer() + alignedSize;
+ m_bufferPointer = m_buffer + alignedSize + size;
+
+ return m_buffer + alignedSize;
}
void ArgumentEncoder::encodeFixedLengthData(const uint8_t* data, size_t size, unsigned alignment)
}
void ArgumentEncoder::encodeFixedLengthData(const uint8_t* data, size_t size, unsigned alignment)
- uint8_t* buffer() { return usesInlineBuffer() ? m_inlineBuffer : m_buffer; }
+ uint8_t* buffer() const { return m_buffer; }
size_t bufferSize() const { return m_bufferSize; }
void addAttachment(const Attachment&);
size_t bufferSize() const { return m_bufferSize; }
void addAttachment(const Attachment&);
ArgumentEncoder();
private:
ArgumentEncoder();
private:
- static const size_t inlineBufferSize = 4096;
- bool usesInlineBuffer() const { return m_bufferCapacity <= inlineBufferSize; }
uint8_t* grow(unsigned alignment, size_t size);
uint8_t* m_buffer;
uint8_t* grow(unsigned alignment, size_t size);
uint8_t* m_buffer;
+ uint8_t* m_bufferPointer;
size_t m_bufferSize;
size_t m_bufferCapacity;
Vector<Attachment> m_attachments;
size_t m_bufferSize;
size_t m_bufferCapacity;
Vector<Attachment> m_attachments;
-
- uint8_t m_inlineBuffer[inlineBufferSize];
};
} // namespace CoreIPC
};
} // namespace CoreIPC