Skip to content

Commit 9b4d2fd

Browse files
TCMalloc Teamcopybara-github
authored andcommitted
Correct prediction hint for nullptr in do_free_with_size()
Change `ABSL_PREDICT_TRUE` to `ABSL_PREDICT_FALSE` for the `ptr == nullptr` check within the non-normal memory path of do_free_with_size(). Deleting a nullptr is a valid but expectedly rare operation in this context. PiperOrigin-RevId: 816920767 Change-Id: I7037b6190a2c1a7dbccc762111fa923e5da22364
1 parent d4f3e84 commit 9b4d2fd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tcmalloc/tcmalloc.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ inline ABSL_ATTRIBUTE_ALWAYS_INLINE void do_free_with_size(void* ptr,
824824
// The optimized path doesn't work with non-normal objects (sampled, cold),
825825
// whose deletions trigger more operations and require to visit metadata.
826826
if (ABSL_PREDICT_FALSE(!IsNormalMemory(ptr))) {
827-
if (ABSL_PREDICT_TRUE(ptr == nullptr)) {
827+
if (ABSL_PREDICT_FALSE(ptr == nullptr)) {
828828
return;
829829
}
830830
if (ABSL_PREDICT_TRUE(IsSelSanMemory(ptr))) {

0 commit comments

Comments
 (0)