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

Unified Diff: src/zone.cc

Issue 1847543002: Expose a lower bound of malloc'd memory via heap statistics (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 9 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
« no previous file with comments | « src/zone.h ('k') | test/cctest/cctest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/zone.cc
diff --git a/src/zone.cc b/src/zone.cc
index 9dcebba2dc1fc8fee3fd4c5fd363e6f55b3b47c0..461ee73745de5ebcaf8caf295e12e89854d65f86 100644
--- a/src/zone.cc
+++ b/src/zone.cc
@@ -72,15 +72,14 @@ class Segment {
size_t size_;
};
-
-Zone::Zone()
+Zone::Zone(base::AccountingAllocator* allocator)
: allocation_size_(0),
segment_bytes_allocated_(0),
position_(0),
limit_(0),
+ allocator_(allocator),
segment_head_(nullptr) {}
-
Zone::~Zone() {
DeleteAll();
DeleteKeptSegment();
@@ -201,7 +200,7 @@ void Zone::DeleteKeptSegment() {
// Creates a new segment, sets it size, and pushes it to the front
// of the segment chain. Returns the new segment.
Segment* Zone::NewSegment(size_t size) {
- Segment* result = reinterpret_cast<Segment*>(Malloced::New(size));
+ Segment* result = reinterpret_cast<Segment*>(allocator_->Allocate(size));
segment_bytes_allocated_ += size;
if (result != nullptr) {
result->Initialize(segment_head_, size);
@@ -214,7 +213,7 @@ Segment* Zone::NewSegment(size_t size) {
// Deletes the given segment. Does not touch the segment chain.
void Zone::DeleteSegment(Segment* segment, size_t size) {
segment_bytes_allocated_ -= size;
- Malloced::Delete(segment);
+ allocator_->Free(segment, size);
}
« no previous file with comments | « src/zone.h ('k') | test/cctest/cctest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698