DiskCacheBasedQuicServerInfo::|new_data_| is not released |
|||
Issue descriptionManual instrumentation shows that DiskCacheBasedQuicServerInfo::|new_data_| is not deallocated, which can waste about 8KiB per Quic session. Similar to what happened in Issue 620853 , std::string::clear() doesn't actually deallocate the memory.
,
Jan 24 2017
My fault. We could have done something similar to the following. Thanks for catching this (to swap an empty string and delete it). It was introduced when we first wrote it. std::string().swap(str); https://codereview.chromium.org/154933003
,
Jan 24 2017
Note it might be slightly better to use STLClearObject() from base/stl_util.h.
,
Jan 24 2017
You could try shrink_to_fit(), though the spec also says that isn't guaranteed to do anything either.
,
Jan 24 2017
Thanks Raman! I have a CL to use std::move() https://codereview.chromium.org/2652893006/. Not sure which way is preferred.
,
Jan 24 2017
I confirmed that both std::move() and base::STLClearObject() will properly do the job. I will use STLClearObject() as it's easier to read. Thanks dcheng@ for the suggestion.
,
Jan 25 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/811b298ca853197b54a6a2bbeefcccdcb9ee98aa commit 811b298ca853197b54a6a2bbeefcccdcb9ee98aa Author: xunjieli <xunjieli@chromium.org> Date: Wed Jan 25 02:44:34 2017 Releases DiskCacheBasedQuicServerInfo::|new_data_| and |pending_write_data_| std::string::clear() doesn't deallocate memory, so the ~8KiB*2 memory taken by |new_data_| and |pending_write_data_| can be around for quite a while (until QuicChromiumClientStream is torn down). This CL deallocate |new_data_| and |pending_write_data_| when they are no longer needed. BUG= 684746 Review-Url: https://codereview.chromium.org/2652893006 Cr-Commit-Position: refs/heads/master@{#445918} [modify] https://crrev.com/811b298ca853197b54a6a2bbeefcccdcb9ee98aa/net/http/disk_cache_based_quic_server_info.cc
,
Jan 25 2017
,
Jan 25 2017
|
|||
►
Sign in to add a comment |
|||
Comment 1 by xunji...@chromium.org
, Jan 24 2017