[libcxx-commits] [libcxx] [libc++] Optimize vector growing of trivially relocatable types (PR #76657)
    Louis Dionne via libcxx-commits 
    libcxx-commits at lists.llvm.org
       
    Thu Feb  1 06:42:52 PST 2024
    
    
  
================
@@ -99,9 +99,10 @@ class MemCounter
 
     void deleteCalled(void * p)
     {
-        assert(p);
-        --outstanding_new;
-        ++delete_called;
+        if (p) {
+          --outstanding_new;
+          ++delete_called;
+        }
     }
 
     void alignedDeleteCalled(void *p, std::size_t a) {
----------------
ldionne wrote:
This one needs to be fixed too, since it's valid to call the aligned delete with a nullptr. So this should be
```c++
if (p) {
  deleteCalled(p);
  ++aligned_delete_called;
  last_delete_align = a;
}
```
https://github.com/llvm/llvm-project/pull/76657
    
    
More information about the libcxx-commits
mailing list