summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-06-17 07:01:53 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-06-17 07:01:53 +0000
commitbe43317b4470d0edf5075d518ce924d2ce65885f (patch)
tree0d248d610d562451a6a13b8817574863afe54d55
parent28f795ea6e70d29710bc10e8d26974d145139686 (diff)
parentb37c01794e75138a3716f371f50f1b72a401bb2e (diff)
downloadscudo-be43317b4470d0edf5075d518ce924d2ce65885f.tar.gz
Snap for 6598320 from b37c01794e75138a3716f371f50f1b72a401bb2e to mainline-release
Change-Id: I980923c68c8c60e37087d59a99d1797302e8fd8b
-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.