mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-28 07:48:14 +08:00
Mark Mentovai
49f170e633
MachMessageServer: 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 Review URL: https://codereview.chromium.org/759023004
Description
Languages
C++
92.6%
Objective-C++
2.5%
C
2%
Python
1.7%
Assembly
0.9%
Other
0.3%