Mojo unneccessarily using 1.6GB of memory |
|||
Issue descriptionSee https://bugs.chromium.org/p/chromium/issues/detail?id=884705 for parent issue. If I had to guess what's going on -- there were a large number of IPCs queued. This caused the underlying message buffer [vector?] to grow in size. Eventually the messages were dequeued but the buffer/vector stayed huge.
,
Sep 24
> Where is the evidence that these messages were dequeued? And dequeued from what? Looks like an incoming message queue if I understand the screenshot correctly. In the parent bug, Chrome was unusable for several hours [while messages were being dequeued], and memory usage spiked to 80GB. It eventually quiesced down to 2GB. > The code which retains incoming messages is pretty trivial. Unless the vector impl itself is broken, the scenario you describe is not possible. Vectors do not shrink by default. I just tested this locally with a test C++ program. pop_back() will never shrink the backing buffer. We need to call shrink_to_fit() to reduce the size of the backing allocation of std::vector.
,
Sep 24
Ah, thanks. Didn't realize that, but it does kind of make sense. Will fix!
,
Sep 24
,
Sep 25
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/7fe00cd1270a395d3f1d66b14e41595a432d6ddc commit 7fe00cd1270a395d3f1d66b14e41595a432d6ddc Author: Ken Rockot <rockot@chromium.org> Date: Tue Sep 25 21:18:20 2018 [mojo-core] Reduce lingering message queue costs Incoming messages are stored in a std::vector which we never shrink when popping off elements. This means its capacity may be allowed to grow indefinitely, which is bad. This CL adds a check when popping messages off the queue, calling shrink_to_fit() if the operation results in the queue crossing an arbitrary size threshold (multiples of 512 elements). Bug: 888665 Change-Id: Ie2b89a2104bcd6d3eece29c339e297cdadbd837b Reviewed-on: https://chromium-review.googlesource.com/1241561 Commit-Queue: Ken Rockot <rockot@chromium.org> Reviewed-by: Reilly Grant <reillyg@chromium.org> Cr-Commit-Position: refs/heads/master@{#594104} [modify] https://crrev.com/7fe00cd1270a395d3f1d66b14e41595a432d6ddc/mojo/core/ports/message_queue.cc
,
Oct 17
|
|||
►
Sign in to add a comment |
|||
Comment 1 by roc...@chromium.org
, Sep 24