DescriptionMachMessageServer: handle allocations more reasonably.
MachMessageServer was wasteful with allocations for request and reply
messages. It allocated new memory for each request receive and for each
reply send, and if it needed to resize an allocation for a request, it
would maintain two request allocations simultaneously. The new behavior
allocates memory for a new request only if it needs a different size
than for the previous request, and it never maintains two request
allocations simultaneously. Memory for a reply is allocated once per
method invocation and maintained, since this never needs to be resized.
One pass of the loop is now guaranteed, even if a caller specifies a
very small timeout that expires before attempting to receive a message.
An infinite looping bug that could occur when ignoring large messages
has also been fixed.
TEST=util_test MachMessageServer.*
R=rsesek@chromium.org
Committed: https://chromium.googlesource.com/crashpad/crashpad/+/49f170e6334865054e617f6e17d72c90f463ed14
Patch Set 1 #
Total comments: 2
Patch Set 2 : Address review feedback #Messages
Total messages: 7 (1 generated)
|