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

Issue 684746 link

Starred by 1 user

Issue metadata

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

Blocking:
issue 620852



Sign in to add a comment

DiskCacheBasedQuicServerInfo::|new_data_| is not released

Project Member Reported by xunji...@chromium.org, Jan 24 2017

Issue description

Manual 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. 

 
This applies to |pending_write_data_| as well.
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

Comment 3 by dcheng@chromium.org, Jan 24 2017

Note it might be slightly better to use STLClearObject() from base/stl_util.h.
You could try shrink_to_fit(), though the spec also says that isn't guaranteed to do anything either.
Thanks Raman!
I have a CL to use std::move() https://codereview.chromium.org/2652893006/. Not sure which way is preferred.

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.
Project Member

Comment 7 by bugdroid1@chromium.org, 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

Status: Fixed (was: Started)
Labels: Performance-Memory

Sign in to add a comment