diff options
| author | 2014-05-02 16:35:37 -0700 | |
|---|---|---|
| committer | 2014-05-05 16:59:01 -0700 | |
| commit | e76e70f424468f311c2061c291e8384263f3968c (patch) | |
| tree | ace430e6682214221feb4101a5b598463f6e0947 /runtime/gc/heap.cc | |
| parent | 0b8027003514c4fa6a850e5087076e991daaf4c3 (diff) | |
Add RecordFree to the GarbageCollector interface
RecordFree now calls the Heap::RecordFree as well as updates the
garbage collector's internal bytes freed accounting.
Change-Id: I8cb03748b0768e3c8c50ea709572960e6e4ad219
Diffstat (limited to 'runtime/gc/heap.cc')
| -rw-r--r-- | runtime/gc/heap.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc index dab668f8ed..4484494f68 100644 --- a/runtime/gc/heap.cc +++ b/runtime/gc/heap.cc @@ -1143,13 +1143,13 @@ void Heap::VerifyHeap() { GetLiveBitmap()->Walk(Heap::VerificationCallback, this); } -void Heap::RecordFree(ssize_t freed_objects, ssize_t freed_bytes) { +void Heap::RecordFree(uint64_t freed_objects, int64_t freed_bytes) { // Use signed comparison since freed bytes can be negative when background compaction foreground // transitions occurs. This is caused by the moving objects from a bump pointer space to a // free list backed space typically increasing memory footprint due to padding and binning. - DCHECK_LE(freed_bytes, static_cast<ssize_t>(num_bytes_allocated_.Load())); - DCHECK_GE(freed_objects, 0); - num_bytes_allocated_.FetchAndSub(freed_bytes); + DCHECK_LE(freed_bytes, static_cast<int64_t>(num_bytes_allocated_.Load())); + // Note: This relies on 2s complement for handling negative freed_bytes. + num_bytes_allocated_.FetchAndSub(static_cast<ssize_t>(freed_bytes)); if (Runtime::Current()->HasStatsEnabled()) { RuntimeStats* thread_stats = Thread::Current()->GetStats(); thread_stats->freed_objects += freed_objects; |