Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1262)

Unified Diff: net/socket/ssl_client_socket_impl.cc

Issue 2696403007: Add a multiplier in tracking certificate memory allocation size (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/socket/ssl_client_socket_impl.cc
diff --git a/net/socket/ssl_client_socket_impl.cc b/net/socket/ssl_client_socket_impl.cc
index e415a4c3e7c20b6a28bbe5f0b30f886f3300ffc5..43c44321e92afcaffbcf3847069652dad75c0035 100644
--- a/net/socket/ssl_client_socket_impl.cc
+++ b/net/socket/ssl_client_socket_impl.cc
@@ -844,14 +844,15 @@ void SSLClientSocketImpl::DumpMemoryStats(SocketMemoryStats* stats) const {
if (server_cert_chain_) {
for (size_t i = 0; i < server_cert_chain_->size(); ++i) {
X509* cert = server_cert_chain_->Get(i);
- // This measures the lower bound of the serialized certificate. It doesn't
- // measure the actual memory used, which is 4x this amount (see
- // crbug.com/671420 for more details).
- stats->serialized_cert_size += i2d_X509(cert, nullptr);
+ // Estimate the size of the certificate before deduplication.
+ // The multiplier (4) is added to account for the difference between the
+ // serialized cert size and the actual cert allocation.
+ // TODO(xunjieli): Update this after crbug.com/671420 is done.
+ stats->cert_size += 4 * i2d_X509(cert, nullptr);
xunjieli 2017/02/16 22:54:24 I didn't find a way to track distinct X509*. This
}
stats->cert_count = server_cert_chain_->size();
}
- stats->total_size = stats->buffer_size + stats->serialized_cert_size;
+ stats->total_size = stats->buffer_size + stats->cert_size;
}
// static

Powered by Google App Engine
This is Rietveld 408576698