summaryrefslogtreecommitdiff
path: root/src/node_http2.cc
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-06-10 16:40:13 +0200
committerAnna Henningsen <anna@addaleax.net>2018-07-13 19:53:15 +0200
commit57e301539bff2599974b7269a56377330c9b730e (patch)
tree6f5c866728f22bbacb8dadb89a2c8a12e5b66508 /src/node_http2.cc
parent36cc5f5caf52af895079d153a9131fe2b0c6b8f9 (diff)
downloadandroid-node-v8-57e301539bff2599974b7269a56377330c9b730e.tar.gz
android-node-v8-57e301539bff2599974b7269a56377330c9b730e.tar.bz2
android-node-v8-57e301539bff2599974b7269a56377330c9b730e.zip
src: enable more detailed memory tracking
This will enable more detailed heap snapshots based on a newer V8 API. This commit itself is not tied to that API and could be backported. PR-URL: https://github.com/nodejs/node/pull/21742 Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_http2.cc')
-rw-r--r--src/node_http2.cc27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/node_http2.cc b/src/node_http2.cc
index 0251777644..7a5e9ba23e 100644
--- a/src/node_http2.cc
+++ b/src/node_http2.cc
@@ -737,7 +737,7 @@ inline void Http2Session::AddStream(Http2Stream* stream) {
size_t size = streams_.size();
if (size > statistics_.max_concurrent_streams)
statistics_.max_concurrent_streams = size;
- IncrementCurrentSessionMemory(stream->self_size());
+ IncrementCurrentSessionMemory(sizeof(*stream));
}
@@ -745,7 +745,7 @@ inline void Http2Session::RemoveStream(Http2Stream* stream) {
if (streams_.empty() || stream == nullptr)
return; // Nothing to remove, item was never added?
streams_.erase(stream->id());
- DecrementCurrentSessionMemory(stream->self_size());
+ DecrementCurrentSessionMemory(sizeof(*stream));
}
// Used as one of the Padding Strategy functions. Will attempt to ensure
@@ -2694,7 +2694,7 @@ Http2Session::Http2Ping* Http2Session::PopPing() {
if (!outstanding_pings_.empty()) {
ping = outstanding_pings_.front();
outstanding_pings_.pop();
- DecrementCurrentSessionMemory(ping->self_size());
+ DecrementCurrentSessionMemory(sizeof(*ping));
}
return ping;
}
@@ -2703,7 +2703,7 @@ bool Http2Session::AddPing(Http2Session::Http2Ping* ping) {
if (outstanding_pings_.size() == max_outstanding_pings_)
return false;
outstanding_pings_.push(ping);
- IncrementCurrentSessionMemory(ping->self_size());
+ IncrementCurrentSessionMemory(sizeof(*ping));
return true;
}
@@ -2712,7 +2712,7 @@ Http2Session::Http2Settings* Http2Session::PopSettings() {
if (!outstanding_settings_.empty()) {
settings = outstanding_settings_.front();
outstanding_settings_.pop();
- DecrementCurrentSessionMemory(settings->self_size());
+ DecrementCurrentSessionMemory(sizeof(*settings));
}
return settings;
}
@@ -2721,7 +2721,7 @@ bool Http2Session::AddSettings(Http2Session::Http2Settings* settings) {
if (outstanding_settings_.size() == max_outstanding_settings_)
return false;
outstanding_settings_.push(settings);
- IncrementCurrentSessionMemory(settings->self_size());
+ IncrementCurrentSessionMemory(sizeof(*settings));
return true;
}
@@ -2766,6 +2766,21 @@ void Http2Session::Http2Ping::Done(bool ack, const uint8_t* payload) {
}
+void nghttp2_stream_write::MemoryInfo(MemoryTracker* tracker) const {
+ tracker->TrackThis(this);
+ if (req_wrap != nullptr)
+ tracker->TrackField("req_wrap", req_wrap->GetAsyncWrap());
+ tracker->TrackField("buf", buf);
+}
+
+
+void nghttp2_header::MemoryInfo(MemoryTracker* tracker) const {
+ tracker->TrackThis(this);
+ tracker->TrackFieldWithSize("name", nghttp2_rcbuf_get_buf(name).len);
+ tracker->TrackFieldWithSize("value", nghttp2_rcbuf_get_buf(value).len);
+}
+
+
// Set up the process.binding('http2') binding.
void Initialize(Local<Object> target,
Local<Value> unused,