mojo::Channel::ReadBuffer keep memory allocated all the time |
|||
Issue descriptionOn Android, ReadBuffer objects always allocated even if the application is left untouched for minutes (expecting no IPC to happen). This keeps around 256KiB of memory always, 4 buffers each of 64KiB. Allocated by the stack trace: [Thread: Chrome_IOThread] </system/lib/libc.so> ThreadFunc base::Thread::ThreadMain() content::BrowserThreadImpl::Run(base::RunLoop*) content::BrowserThreadImpl::IOThreadRun(base::RunLoop*) base::RunLoop::Run() base::MessageLoop::RunHandler() base::MessagePumpLibevent::Run(base::MessagePump::Delegate*) event_base_loop base::MessagePumpLibevent::OnLibeventNotification(int, short, void*) OnFileCanReadWithoutBlocking mojo::edk::Channel::OnReadComplete(unsigned int, unsigned int*) base::AlignedAlloc(unsigned int, unsigned int) 1. Can we clear the memory when not used? 2. Or reduce the buffer length for Android? 3. Only 4 buffers when taking a snapshot at any point. Can this number grow higher? Attached a trace file.
,
Feb 15 2017
Yes. it is seen on each renderer as 64KiB. Yes there are 4 child processes 2 sites, 1 blank and 1 gpu. So, a total of 512Kib is used across all processes for the read buffer. Also it might be good to investigate why we could go upto 256MiB message on Android. I will look into this.
,
Feb 15 2017
I only meant that the code at this layer is written to allow messages to be that long. In practice we have a stricter limit on message length elsewhere, and I doubt we even approach that limit anyway.
,
Feb 15 2017
Okay, just tried to open 15 tabs and this buffers grew to 1Mib in browser and 1MiB all renderers. Maybe we should try to clear these for background tabs?
,
Feb 15 2017
I don't think it makes sense to plumb any browser state all the way down to this layer. Again, all buffers should shrink back down to 64 kB ASAP once unused, and we should be able to find a more suitable number for that state.
,
Feb 17 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/adb217e7938f1f84c3f528bec160f9cfa35fb74d commit adb217e7938f1f84c3f528bec160f9cfa35fb74d Author: rockot <rockot@chromium.org> Date: Fri Feb 17 04:30:30 2017 Mojo EDK: Reduce unused read buffer capacity Reduces the unused read buffer capacity from 64k to 4k. A simple empirical measurement shows that ~90% of all messages received by the browser in a "typical" browsing session are no larger than 4k, so the extra allocations here should not have a significant performance impact. BUG= 692369 Review-Url: https://codereview.chromium.org/2701513005 Cr-Commit-Position: refs/heads/master@{#451209} [modify] https://crrev.com/adb217e7938f1f84c3f528bec160f9cfa35fb74d/mojo/edk/system/channel.cc
,
Feb 17 2017
This should be taken care of. Please let me know if you think it's still problematic to keep a 4kB buffer lying around for each IPC endpoint. |
|||
►
Sign in to add a comment |
|||
Comment 1 by roc...@chromium.org
, Feb 15 2017Owner: roc...@chromium.org
Status: Assigned (was: Untriaged)