summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAliaksey Kandratsenka <alkondratenko@gmail.com>2016-03-12 14:25:10 -0800
committerAliaksey Kandratsenka <alkondratenko@gmail.com>2017-05-14 19:04:55 -0700
commit507a105e849422d5ceff4348d38aaf72371a6161 (patch)
tree375bd7e83de461c3ba984ebfd8e32a1ab0b9fec9
parentbb77979dea796ab743e1308af25e9259ec97f2b1 (diff)
downloadgperftools-507a105e849422d5ceff4348d38aaf72371a6161.tar.gz
pass original size to DoSampledAllocation
It makes heap profiles more accurate. Google's internal malloc is doing it as well.
-rw-r--r--src/tcmalloc.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/tcmalloc.cc b/src/tcmalloc.cc
index 28b139e..65684af 100644
--- a/src/tcmalloc.cc
+++ b/src/tcmalloc.cc
@@ -1264,14 +1264,14 @@ ALWAYS_INLINE void* do_malloc_small(ThreadCache* heap, size_t size) {
ASSERT(Static::IsInited());
ASSERT(heap != NULL);
size_t cl = Static::sizemap()->SizeClass(size);
- size = Static::sizemap()->class_to_size(cl);
+ size_t allocated_size = Static::sizemap()->class_to_size(cl);
- if (PREDICT_FALSE(heap->SampleAllocation(size))) {
+ if (PREDICT_FALSE(heap->SampleAllocation(allocated_size))) {
return DoSampledAllocation(size);
} else {
// The common case, and also the simplest. This just pops the
// size-appropriate freelist, after replenishing it if it's empty.
- return CheckedMallocResult(heap->Allocate(size, cl));
+ return CheckedMallocResult(heap->Allocate(allocated_size, cl));
}
}