New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 674625 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Jan 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 674287



Sign in to add a comment

std::queue used by Blink's TaskQueueImpl wastes memory

Project Member Reported by dskiba@chromium.org, Dec 15 2016

Issue description

STL instrumentation revealed that blink::internal::AnyThread::immediate_incoming_queue is responsible for ~500 KiB of memory, most of which is unused, see thread on memory-trim:  https://groups.google.com/a/chromium.org/d/msg/project-trim/rX9mshct51w/2ZuiYS1hCgAJ

See also issue 674287, which details std::deque internals. 

 

Comment 1 by dskiba@chromium.org, Dec 15 2016

Another std::deque usage: WorkQueue::work_queue_ (which is std::queue, but queues are backed by std::deque by default) can allocate up to 180 KiB.
Cc: primiano@chromium.org
How do you actually measure the memory for this?  I have a patch which changes the implementation, but looking at some memory infra traces it didn't seem to help so I haven't landed it.

https://codereview.chromium.org/2579773002/
Components: -Blink>Internals Blink>Scheduling
Ah I see it's https://codereview.chromium.org/2572593002.  I'll give it a try with that patched in.

Comment 5 by dskiba@chromium.org, Jan 10 2017

Yeah, that's the CL, but since you're using wtf::Deque, you'll need to somehow instrument it too? Also, don't forget to gn clean before building.

BTW, what are memory properties of wtf::Deque, does it preallocate blocks of fixed size / specific number of elements?
Not sure why the bots didn't post but I landed https://codereview.chromium.org/2579773002/ which does this.   Based on some perf try jobs it looks to be a nice win for pages with lots of frames.

Anyway WTF::Deque is basically a wrapper on top of WTF::Vector with a 1.5x factor when resizing. An empty queue is tiny, which is good since typically most queues will be empty or nearly empty.

https://00e9e64bac20b10de727e68a8e829da98dd153048f159933f7-apidata.googleusercontent.com/download/storage/v1/b/chrome-telemetry-output/o/html-results%2Fresults-2017-01-12_07-28-56?qk=AD5uMEsAHDqMZ7yC0TaOpEBKIArBLOSAoI2--H7kHGI-nBBOTgRTvo_d-futZlu8F3ixIbNRcFG7xfFyx9FUT77zJUXAaBFbKFFIJt5a0ylNf1eLuxy3C2vb6CAkosf3V--guPlpljIVxgNjqwOXcOzhxhEyZf4XVoCVpVR-4d2BmVfnFrg4Z_F1sZGd9ncjKOlEfakWWkQG6yRpfeVTLfp27yAbsdqFmnWgUrO_6Z_fvF99qyZyUN33PxBYj1iOmSK7BSlRqEtgQkKm1ET63Z_spMIzt87LQMgAmgJoROaJOGcKjGApQLtGBqnh7i3fx3_rbRXCt8z1DJSCy_aCoyGCebHnnNDUinwl_TAv3eBPzLgb43DORyuzzz9R_pnpzzYkfnsqq3DIXXbmWP3zpVbgXfkJMc6L18aKY49djlAjzdx7Z_wE5YfeVGGSjwS8MyFt8nts6mPfLbpBTvVesy_uCKbRqyxmGBscxwZI92DgOBh7aFjcYqy9JXMTwKisb-Pt1hnSxf_q3mB4hnwyUVk7QvlwBCaO44PHIHmz0f2o80DZmsTSaZ_r2n4kx9UTJaBzDUcdjuTTXhiWSkPPEh4kqrKbSTL_2hPl7WjjkF7ucGR9HqdBlgGOf9gt2qSNT5ShQu4SCd91qL-RbH9JTPu9UFe4YpImngF66WdgSlTiiKlk1kqTYEvrB-_obs5XpTqcN7DXGN1ZjAZuuhjkauQqkG73oXtCu92BEMOdtHkbIc1FK5_Kc97VlxJzsvAHZqJkA8giNaUvf5SE-5eaMGMNkMOViFilPrXRt9_Z3QXq_EA_TJdTnpMzyp4Cjm9AF1eLxpBuJXFp

https://00e9e64bac4de7ed8793367c5c4dd245bac40c42408c7cc185-apidata.googleusercontent.com/download/storage/v1/b/chrome-telemetry-output/o/html-results%2Fresults-2017-01-12_07-09-31?qk=AD5uMEtat5PBfIq_o9BNwU1StgiRwsb9TU_ti3UZfhgpVamZAova2vznpzDj46tULaCtW3neAFvSkf8a1uIqGPNQHpvoG6JfradaYWtKRnrlm0rXeTYhUaeKl1N6Q6c5EsQHbo_Heoq1gOPGpnrgximEY2wIsXcTy0P195yaKfHD4X_vG6oRC2HHbK975DTizbQGqOb__ygLL1K_rAcStYvXDIr1LENBxYxGTFLYMlvgsJw-lXAVTt2R0S-Rc6C9Vt-hxopOEKFZ5vQ9OLo8f0e1V9UG0P2ABKZTVjK_XAcVu1iQfGALUOSczW4Ilz0JXDwGEGcRstVGmSy5l6kyQWwhQK92wBjzX7h8hcayfPYvErYqJ8Y0OLTXSPVFE6XIQ7dWKBDZadiB2iTnLEOkd8VOcvtCY8eiqL_kg1uoiBZTEu43gamY0x4SK4QKviT-A695MXirPa7fLL6OKTL6wQod_hepf7gEtC-FWrs6rlDSFww5qZmwgC-9OBH5rvsXkz6H4mN2OoqYBh6IN8IhC3doUkVt-mR6JYXlMb7Mx7rJX-H2z8176JHzNz2YseZVORt8wu2Qzub56z5AtKpmMOvXCNbW6uCLDvMRCM-hVfq9P7FDiGau4wahEpSmQcpuoXP6oTSW7PbowoLmejmA9HRjh3kwJy0Ff9HYIdy8P0FwAwTLibi3R-h8G-9Dogvd5Oac10sxDr_9dQJR6OrhOmOM8UrEcK_BQ08pRkIAXomNtJlHTK4N8-WVcGeJZKwe-Lb-18YnsJmkykLwwn0UVC6OrSiqiNhtkB1Es-yMZyN5aqhB45GnfnSSg57LC7sFVjNfjAUMEEhv
Owner: alexclarke@chromium.org
Status: Started (was: Untriaged)
I'll wait for the perf bots to cycle but hopefully we should see a reduction,
Status: Fixed (was: Started)
On the bots malloc memory usage went down by more than partition alloc went up, nice.

https://chromeperf.appspot.com/report?sid=541c24dd69f4a7d18f0dfb96ab5bd8c39f9518df4e5c012afbb59f3e527f2002&start_rev=440688&end_rev=443845
\o/ Fantastique!

Sign in to add a comment