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

Side by Side Diff: src/api.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, 8 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 unified diff | Download patch
« no previous file with comments | « include/v8.h ('k') | src/background-parsing-task.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 5476 matching lines...) Expand 10 before | Expand all | Expand 10 after
5487 5487
5488 5488
5489 bool v8::V8::Dispose() { 5489 bool v8::V8::Dispose() {
5490 i::V8::TearDown(); 5490 i::V8::TearDown();
5491 #ifdef V8_USE_EXTERNAL_STARTUP_DATA 5491 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
5492 i::DisposeNatives(); 5492 i::DisposeNatives();
5493 #endif 5493 #endif
5494 return true; 5494 return true;
5495 } 5495 }
5496 5496
5497 5497 HeapStatistics::HeapStatistics()
5498 HeapStatistics::HeapStatistics(): total_heap_size_(0), 5498 : total_heap_size_(0),
5499 total_heap_size_executable_(0), 5499 total_heap_size_executable_(0),
5500 total_physical_size_(0), 5500 total_physical_size_(0),
5501 used_heap_size_(0), 5501 total_available_size_(0),
5502 heap_size_limit_(0) { } 5502 used_heap_size_(0),
5503 5503 heap_size_limit_(0),
5504 malloced_memory_(0),
5505 does_zap_garbage_(0) {}
5504 5506
5505 HeapSpaceStatistics::HeapSpaceStatistics(): space_name_(0), 5507 HeapSpaceStatistics::HeapSpaceStatistics(): space_name_(0),
5506 space_size_(0), 5508 space_size_(0),
5507 space_used_size_(0), 5509 space_used_size_(0),
5508 space_available_size_(0), 5510 space_available_size_(0),
5509 physical_space_size_(0) { } 5511 physical_space_size_(0) { }
5510 5512
5511 5513
5512 HeapObjectStatistics::HeapObjectStatistics() 5514 HeapObjectStatistics::HeapObjectStatistics()
5513 : object_type_(nullptr), 5515 : object_type_(nullptr),
(...skipping 1880 matching lines...) Expand 10 before | Expand all | Expand 10 after
7394 void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) { 7396 void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) {
7395 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 7397 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
7396 i::Heap* heap = isolate->heap(); 7398 i::Heap* heap = isolate->heap();
7397 heap_statistics->total_heap_size_ = heap->CommittedMemory(); 7399 heap_statistics->total_heap_size_ = heap->CommittedMemory();
7398 heap_statistics->total_heap_size_executable_ = 7400 heap_statistics->total_heap_size_executable_ =
7399 heap->CommittedMemoryExecutable(); 7401 heap->CommittedMemoryExecutable();
7400 heap_statistics->total_physical_size_ = heap->CommittedPhysicalMemory(); 7402 heap_statistics->total_physical_size_ = heap->CommittedPhysicalMemory();
7401 heap_statistics->total_available_size_ = heap->Available(); 7403 heap_statistics->total_available_size_ = heap->Available();
7402 heap_statistics->used_heap_size_ = heap->SizeOfObjects(); 7404 heap_statistics->used_heap_size_ = heap->SizeOfObjects();
7403 heap_statistics->heap_size_limit_ = heap->MaxReserved(); 7405 heap_statistics->heap_size_limit_ = heap->MaxReserved();
7406 heap_statistics->malloced_memory_ =
7407 isolate->allocator()->GetCurrentMemoryUsage();
7404 heap_statistics->does_zap_garbage_ = heap->ShouldZapGarbage(); 7408 heap_statistics->does_zap_garbage_ = heap->ShouldZapGarbage();
7405 } 7409 }
7406 7410
7407 7411
7408 size_t Isolate::NumberOfHeapSpaces() { 7412 size_t Isolate::NumberOfHeapSpaces() {
7409 return i::LAST_SPACE - i::FIRST_SPACE + 1; 7413 return i::LAST_SPACE - i::FIRST_SPACE + 1;
7410 } 7414 }
7411 7415
7412 7416
7413 bool Isolate::GetHeapSpaceStatistics(HeapSpaceStatistics* space_statistics, 7417 bool Isolate::GetHeapSpaceStatistics(HeapSpaceStatistics* space_statistics,
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after
8778 Address callback_address = 8782 Address callback_address =
8779 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8783 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8780 VMState<EXTERNAL> state(isolate); 8784 VMState<EXTERNAL> state(isolate);
8781 ExternalCallbackScope call_scope(isolate, callback_address); 8785 ExternalCallbackScope call_scope(isolate, callback_address);
8782 callback(info); 8786 callback(info);
8783 } 8787 }
8784 8788
8785 8789
8786 } // namespace internal 8790 } // namespace internal
8787 } // namespace v8 8791 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/background-parsing-task.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698