summaryrefslogtreecommitdiff
path: root/runtime/gc/heap.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/gc/heap.cc')
-rw-r--r--runtime/gc/heap.cc8
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;