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

Unified Diff: runtime/vm/pages.cc

Issue 187113003: Track external allocated memory for weak persistent handles. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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: runtime/vm/pages.cc
===================================================================
--- runtime/vm/pages.cc (revision 33235)
+++ runtime/vm/pages.cc (working copy)
@@ -126,6 +126,7 @@
max_capacity_in_words_(max_capacity_in_words),
capacity_in_words_(0),
used_in_words_(0),
+ external_allocated_in_words_(0),
sweeping_(false),
page_space_controller_(FLAG_heap_growth_space_ratio,
FLAG_heap_growth_rate,
@@ -272,6 +273,22 @@
}
+void PageSpace::AllocateExternal(intptr_t size) {
+ intptr_t size_in_words = size >> kWordSizeLog2;
+ external_allocated_in_words_ += size_in_words;
+ capacity_in_words_ += size_in_words;
+ used_in_words_ += size_in_words;
+}
+
+
+void PageSpace::FreeExternal(intptr_t size) {
+ intptr_t size_in_words = size >> kWordSizeLog2;
+ external_allocated_in_words_ -= size_in_words;
+ capacity_in_words_ -= size_in_words;
+ used_in_words_ -= size_in_words;
+}
+
+
bool PageSpace::Contains(uword addr) const {
HeapPage* page = pages_;
while (page != NULL) {
@@ -541,6 +558,7 @@
}
// Record data and print if requested.
+ used_in_words += external_allocated_in_words_;
Ivan Posva 2014/03/05 21:21:23 We probably want to track these separately in the
koda 2014/03/05 21:52:08 Done.
intptr_t used_before_in_words = used_in_words_;
used_in_words_ = used_in_words;
« runtime/vm/heap.h ('K') | « runtime/vm/pages.h ('k') | runtime/vm/scavenger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698