summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2020-06-17 00:28:39 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-06-17 00:28:39 +0000
commit0dcb8837c72fc2a8437982119d7e21343ededb6a (patch)
tree0d248d610d562451a6a13b8817574863afe54d55
parent1d7584913b6c84a7936d692033cfd4b5b96f6bbf (diff)
parent22b24a2ba359143ea40ceec99a81abaad551f3f9 (diff)
downloadscudo-0dcb8837c72fc2a8437982119d7e21343ededb6a.tar.gz
Release smaller classes only when there are lots of free chunks. am: 22b24a2ba3
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/scudo/+/11885527 Change-Id: I2a07901adfbf1e49740436bc8ff48c20e7fd7aef
-rw-r--r--standalone/local_cache.h1
-rw-r--r--standalone/primary32.h8
2 files changed, 9 insertions, 0 deletions
diff --git a/standalone/local_cache.h b/standalone/local_cache.h
index a6425fc6d1e..089aeb93962 100644
--- a/standalone/local_cache.h
+++ b/standalone/local_cache.h
@@ -159,6 +159,7 @@ private:
DCHECK_GT(B->getCount(), 0);
C->Count = B->getCount();
B->copyToArray(C->Chunks);
+ B->clear();
destroyBatch(ClassId, B);
return true;
}
diff --git a/standalone/primary32.h b/standalone/primary32.h
index 9dac4989991..262793158b0 100644
--- a/standalone/primary32.h
+++ b/standalone/primary32.h
@@ -446,6 +446,14 @@ private:
}
}
+ if (BlockSize < PageSize / 16) {
+ if (BytesPushed < (Sci->AllocatedUser / 16U))
+ return 0;
+ if (BytesInFreeList / (Sci->AllocatedUser / 100U) <
+ (100U - getMostSignificantSetBitIndex(BlockSize) * 2))
+ return 0;
+ }
+
// TODO(kostyak): currently not ideal as we loop over all regions and
// iterate multiple times over the same freelist if a ClassId spans multiple
// regions. But it will have to do for now.